forked from quic-go/quic-go
add version to inchoate CHLO
This commit is contained in:
@@ -2,6 +2,7 @@ package handshake
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/binary"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/lucas-clemente/quic-go/crypto"
|
"github.com/lucas-clemente/quic-go/crypto"
|
||||||
@@ -82,6 +83,10 @@ func (h *cryptoSetupClient) getInchoateCHLOValues() map[Tag][]byte {
|
|||||||
tags[TagPDMD] = []byte("X509")
|
tags[TagPDMD] = []byte("X509")
|
||||||
tags[TagPAD] = bytes.Repeat([]byte("0"), protocol.ClientHelloMinimumSize)
|
tags[TagPAD] = bytes.Repeat([]byte("0"), protocol.ClientHelloMinimumSize)
|
||||||
|
|
||||||
|
versionTag := make([]byte, 4, 4)
|
||||||
|
binary.LittleEndian.PutUint32(versionTag, protocol.VersionNumberToTag(h.version))
|
||||||
|
tags[TagVER] = versionTag
|
||||||
|
|
||||||
return tags
|
return tags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ var _ = Describe("Crypto setup", func() {
|
|||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
cs = cryptoSetupClient{
|
cs = cryptoSetupClient{
|
||||||
cryptoStream: &mockStream{},
|
cryptoStream: &mockStream{},
|
||||||
|
version: protocol.Version36,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ var _ = Describe("Crypto setup", func() {
|
|||||||
tags := cs.getInchoateCHLOValues()
|
tags := cs.getInchoateCHLOValues()
|
||||||
Expect(tags).To(HaveKey(TagSNI))
|
Expect(tags).To(HaveKey(TagSNI))
|
||||||
Expect(tags[TagPDMD]).To(Equal([]byte("X509")))
|
Expect(tags[TagPDMD]).To(Equal([]byte("X509")))
|
||||||
|
Expect(tags[TagVER]).To(Equal([]byte("Q036")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("is longer than the miminum client hello size", func() {
|
It("is longer than the miminum client hello size", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user