forked from quic-go/quic-go
set the Long Header packet type based on the state of the handshake
This commit is contained in:
@@ -24,7 +24,7 @@ type Header struct {
|
||||
DiversificationNonce []byte
|
||||
|
||||
// only needed for the IETF Header
|
||||
Type uint8
|
||||
Type protocol.PacketType
|
||||
IsLongHeader bool
|
||||
KeyPhase int
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ func parseLongHeader(b *bytes.Reader, packetSentBy protocol.Perspective, typeByt
|
||||
return nil, err
|
||||
}
|
||||
h := &Header{
|
||||
Type: typeByte & 0x7f,
|
||||
Type: protocol.PacketType(typeByte & 0x7f),
|
||||
IsLongHeader: true,
|
||||
ConnectionID: protocol.ConnectionID(connID),
|
||||
PacketNumber: protocol.PacketNumber(pn),
|
||||
|
||||
@@ -32,7 +32,7 @@ var _ = Describe("IETF draft Header", func() {
|
||||
b := bytes.NewReader(data)
|
||||
h, err := parseHeader(b, protocol.PerspectiveClient)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(h.Type).To(BeEquivalentTo(3))
|
||||
Expect(h.Type).To(Equal(protocol.PacketType(3)))
|
||||
Expect(h.IsLongHeader).To(BeTrue())
|
||||
Expect(h.OmitConnectionID).To(BeFalse())
|
||||
Expect(h.ConnectionID).To(Equal(protocol.ConnectionID(0xdeadbeefcafe1337)))
|
||||
@@ -62,6 +62,7 @@ var _ = Describe("IETF draft Header", func() {
|
||||
b := bytes.NewReader(data)
|
||||
h, err := parseHeader(b, protocol.PerspectiveServer)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(h.Type).To(Equal(protocol.PacketTypeVersionNegotiation))
|
||||
Expect(h.SupportedVersions).To(Equal([]protocol.VersionNumber{
|
||||
0x22334455,
|
||||
0x33445566,
|
||||
|
||||
Reference in New Issue
Block a user