mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
remove the LongHeader field from the wire.Header
This commit is contained in:
parent
aca052dc7c
commit
86edf7fd4b
23 changed files with 154 additions and 363 deletions
|
@ -66,7 +66,7 @@ var _ = Describe("Connection", func() {
|
|||
if isLongHeader {
|
||||
packet.longHdrPackets = []*longHeaderPacket{{
|
||||
header: &wire.ExtendedHeader{
|
||||
Header: wire.Header{IsLongHeader: true},
|
||||
Header: wire.Header{},
|
||||
PacketNumber: pn,
|
||||
},
|
||||
length: 6, // foobar
|
||||
|
@ -659,7 +659,6 @@ var _ = Describe("Connection", func() {
|
|||
}
|
||||
|
||||
getLongHeaderPacket := func(extHdr *wire.ExtendedHeader, data []byte) *receivedPacket {
|
||||
ExpectWithOffset(1, extHdr.IsLongHeader).To(BeTrue())
|
||||
buf := &bytes.Buffer{}
|
||||
Expect(extHdr.Write(buf, conn.version)).To(Succeed())
|
||||
return &receivedPacket{
|
||||
|
@ -671,7 +670,6 @@ var _ = Describe("Connection", func() {
|
|||
|
||||
It("drops Retry packets", func() {
|
||||
p := getLongHeaderPacket(&wire.ExtendedHeader{Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeRetry,
|
||||
DestConnectionID: destConnID,
|
||||
SrcConnectionID: srcConnID,
|
||||
|
@ -698,9 +696,8 @@ var _ = Describe("Connection", func() {
|
|||
It("drops packets for which header decryption fails", func() {
|
||||
p := getLongHeaderPacket(&wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
Version: conn.version,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
Version: conn.version,
|
||||
},
|
||||
PacketNumberLen: protocol.PacketNumberLen2,
|
||||
}, nil)
|
||||
|
@ -712,9 +709,8 @@ var _ = Describe("Connection", func() {
|
|||
It("drops packets for which the version is unsupported", func() {
|
||||
p := getLongHeaderPacket(&wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
Version: conn.version + 1,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
Version: conn.version + 1,
|
||||
},
|
||||
PacketNumberLen: protocol.PacketNumberLen2,
|
||||
}, nil)
|
||||
|
@ -732,7 +728,6 @@ var _ = Describe("Connection", func() {
|
|||
protocol.SupportedVersions = append(protocol.SupportedVersions, conn.version+1)
|
||||
p := getLongHeaderPacket(&wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
DestConnectionID: destConnID,
|
||||
SrcConnectionID: srcConnID,
|
||||
|
@ -747,7 +742,6 @@ var _ = Describe("Connection", func() {
|
|||
It("informs the ReceivedPacketHandler about non-ack-eliciting packets", func() {
|
||||
hdr := &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeInitial,
|
||||
DestConnectionID: srcConnID,
|
||||
Version: protocol.Version1,
|
||||
|
@ -819,7 +813,6 @@ var _ = Describe("Connection", func() {
|
|||
expectReplaceWithClosed()
|
||||
p := getLongHeaderPacket(&wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
DestConnectionID: srcConnID,
|
||||
Version: conn.version,
|
||||
|
@ -982,7 +975,6 @@ var _ = Describe("Connection", func() {
|
|||
It("ignores packets with a different source connection ID", func() {
|
||||
hdr1 := &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeInitial,
|
||||
DestConnectionID: destConnID,
|
||||
SrcConnectionID: srcConnID,
|
||||
|
@ -994,7 +986,6 @@ var _ = Describe("Connection", func() {
|
|||
}
|
||||
hdr2 := &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeInitial,
|
||||
DestConnectionID: destConnID,
|
||||
SrcConnectionID: protocol.ParseConnectionID([]byte{0xde, 0xad, 0xbe, 0xef}),
|
||||
|
@ -1026,7 +1017,6 @@ var _ = Describe("Connection", func() {
|
|||
conn.handshakeComplete = false
|
||||
hdr := &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
DestConnectionID: destConnID,
|
||||
SrcConnectionID: srcConnID,
|
||||
|
@ -1060,7 +1050,6 @@ var _ = Describe("Connection", func() {
|
|||
getPacketWithLength := func(connID protocol.ConnectionID, length protocol.ByteCount) (int /* header length */, *receivedPacket) {
|
||||
hdr := &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
DestConnectionID: connID,
|
||||
SrcConnectionID: destConnID,
|
||||
|
@ -1083,7 +1072,7 @@ var _ = Describe("Connection", func() {
|
|||
return &unpackedPacket{
|
||||
encryptionLevel: protocol.EncryptionHandshake,
|
||||
data: []byte{0},
|
||||
hdr: &wire.ExtendedHeader{Header: wire.Header{IsLongHeader: true}},
|
||||
hdr: &wire.ExtendedHeader{Header: wire.Header{}},
|
||||
}, nil
|
||||
})
|
||||
tracer.EXPECT().ReceivedLongHeaderPacket(gomock.Any(), protocol.ByteCount(len(packet.data)), gomock.Any())
|
||||
|
@ -1099,7 +1088,7 @@ var _ = Describe("Connection", func() {
|
|||
data: []byte{0},
|
||||
hdr: &wire.ExtendedHeader{
|
||||
PacketNumber: 1,
|
||||
Header: wire.Header{SrcConnectionID: destConnID, IsLongHeader: true},
|
||||
Header: wire.Header{SrcConnectionID: destConnID},
|
||||
},
|
||||
}, nil
|
||||
})
|
||||
|
@ -1111,7 +1100,7 @@ var _ = Describe("Connection", func() {
|
|||
data: []byte{0},
|
||||
hdr: &wire.ExtendedHeader{
|
||||
PacketNumber: 2,
|
||||
Header: wire.Header{SrcConnectionID: destConnID, IsLongHeader: true},
|
||||
Header: wire.Header{SrcConnectionID: destConnID},
|
||||
},
|
||||
}, nil
|
||||
})
|
||||
|
@ -1134,7 +1123,7 @@ var _ = Describe("Connection", func() {
|
|||
return &unpackedPacket{
|
||||
encryptionLevel: protocol.EncryptionHandshake,
|
||||
data: []byte{0},
|
||||
hdr: &wire.ExtendedHeader{Header: wire.Header{IsLongHeader: true}},
|
||||
hdr: &wire.ExtendedHeader{Header: wire.Header{}},
|
||||
}, nil
|
||||
}),
|
||||
)
|
||||
|
@ -1158,7 +1147,7 @@ var _ = Describe("Connection", func() {
|
|||
return &unpackedPacket{
|
||||
encryptionLevel: protocol.EncryptionHandshake,
|
||||
data: []byte{0},
|
||||
hdr: &wire.ExtendedHeader{Header: wire.Header{IsLongHeader: true}},
|
||||
hdr: &wire.ExtendedHeader{Header: wire.Header{}},
|
||||
}, nil
|
||||
})
|
||||
_, packet2 := getPacketWithLength(wrongConnID, 123)
|
||||
|
@ -1761,20 +1750,14 @@ var _ = Describe("Connection", func() {
|
|||
longHdrPackets: []*longHeaderPacket{
|
||||
{
|
||||
header: &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeInitial,
|
||||
},
|
||||
Header: wire.Header{Type: protocol.PacketTypeInitial},
|
||||
PacketNumber: 13,
|
||||
},
|
||||
length: 123,
|
||||
},
|
||||
{
|
||||
header: &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
},
|
||||
Header: wire.Header{Type: protocol.PacketTypeHandshake},
|
||||
PacketNumber: 37,
|
||||
},
|
||||
length: 1234,
|
||||
|
@ -2454,7 +2437,6 @@ var _ = Describe("Client Connection", func() {
|
|||
newConnID := protocol.ParseConnectionID([]byte{1, 3, 3, 7, 1, 3, 3, 7})
|
||||
p := getPacket(&wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
SrcConnectionID: newConnID,
|
||||
DestConnectionID: srcConnID,
|
||||
|
@ -2495,7 +2477,6 @@ var _ = Describe("Client Connection", func() {
|
|||
}, nil
|
||||
})
|
||||
hdr := &wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeHandshake,
|
||||
DestConnectionID: srcConnID,
|
||||
SrcConnectionID: destConnID,
|
||||
|
@ -2652,7 +2633,6 @@ var _ = Describe("Client Connection", func() {
|
|||
JustBeforeEach(func() {
|
||||
retryHdr = &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeRetry,
|
||||
SrcConnectionID: protocol.ParseConnectionID([]byte{0xde, 0xad, 0xbe, 0xef}),
|
||||
DestConnectionID: protocol.ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8}),
|
||||
|
@ -2903,7 +2883,6 @@ var _ = Describe("Client Connection", func() {
|
|||
|
||||
hdr1 := &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeInitial,
|
||||
DestConnectionID: destConnID,
|
||||
SrcConnectionID: srcConnID,
|
||||
|
@ -2915,7 +2894,6 @@ var _ = Describe("Client Connection", func() {
|
|||
}
|
||||
hdr2 := &wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketTypeInitial,
|
||||
DestConnectionID: destConnID,
|
||||
SrcConnectionID: protocol.ParseConnectionID([]byte{0xde, 0xad, 0xbe, 0xef}),
|
||||
|
@ -2943,7 +2921,6 @@ var _ = Describe("Client Connection", func() {
|
|||
It("ignores 0-RTT packets", func() {
|
||||
p := getPacket(&wire.ExtendedHeader{
|
||||
Header: wire.Header{
|
||||
IsLongHeader: true,
|
||||
Type: protocol.PacketType0RTT,
|
||||
DestConnectionID: srcConnID,
|
||||
Length: 2 + 6,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue