mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 13:17:36 +03:00
Merge pull request #1306 from lucas-clemente/new-header
implement the new IETF QUIC packet header
This commit is contained in:
commit
c1d8c8940e
39 changed files with 799 additions and 501 deletions
|
@ -66,7 +66,7 @@ var _ = Describe("Packet packer", func() {
|
|||
divNonce = bytes.Repeat([]byte{'e'}, 32)
|
||||
|
||||
packer = newPacketPacker(
|
||||
0x1337,
|
||||
protocol.ConnectionID{0, 0, 0, 0, 0, 0, 0x13, 0x37},
|
||||
1,
|
||||
func(protocol.PacketNumber) protocol.PacketNumberLen { return protocol.PacketNumberLen2 },
|
||||
&net.TCPAddr{},
|
||||
|
@ -84,22 +84,23 @@ var _ = Describe("Packet packer", func() {
|
|||
})
|
||||
|
||||
Context("determining the maximum packet size", func() {
|
||||
connID := protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8}
|
||||
It("uses the minimum initial size, if it can't determine if the remote address is IPv4 or IPv6", func() {
|
||||
remoteAddr := &net.TCPAddr{}
|
||||
packer = newPacketPacker(0x1337, 1, nil, remoteAddr, nil, nil, nil, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||
packer = newPacketPacker(connID, 1, nil, remoteAddr, nil, nil, nil, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||
Expect(packer.maxPacketSize).To(BeEquivalentTo(protocol.MinInitialPacketSize))
|
||||
})
|
||||
|
||||
It("uses the maximum IPv4 packet size, if the remote address is IPv4", func() {
|
||||
remoteAddr := &net.UDPAddr{IP: net.IPv4(11, 12, 13, 14), Port: 1337}
|
||||
packer = newPacketPacker(0x1337, 1, nil, remoteAddr, nil, nil, nil, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||
packer = newPacketPacker(connID, 1, nil, remoteAddr, nil, nil, nil, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||
Expect(packer.maxPacketSize).To(BeEquivalentTo(protocol.MaxPacketSizeIPv4))
|
||||
})
|
||||
|
||||
It("uses the maximum IPv6 packet size, if the remote address is IPv6", func() {
|
||||
ip := net.ParseIP("2001:0db8:85a3:0000:0000:8a2e:0370:7334")
|
||||
remoteAddr := &net.UDPAddr{IP: ip, Port: 1337}
|
||||
packer = newPacketPacker(0x1337, 1, nil, remoteAddr, nil, nil, nil, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||
packer = newPacketPacker(connID, 1, nil, remoteAddr, nil, nil, nil, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||
Expect(packer.maxPacketSize).To(BeEquivalentTo(protocol.MaxPacketSizeIPv6))
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue