mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
only set the destination connection ID for the Public Header
This commit is contained in:
parent
c9a9b57030
commit
fc57bf6c35
12 changed files with 31 additions and 62 deletions
|
@ -17,7 +17,6 @@ var _ = Describe("Client Multiplexer", func() {
|
||||||
getPacket := func(connID protocol.ConnectionID) []byte {
|
getPacket := func(connID protocol.ConnectionID) []byte {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
err := (&wire.Header{
|
err := (&wire.Header{
|
||||||
SrcConnectionID: connID,
|
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
PacketNumberLen: protocol.PacketNumberLen1,
|
PacketNumberLen: protocol.PacketNumberLen1,
|
||||||
}).Write(buf, protocol.PerspectiveServer, protocol.VersionWhatever)
|
}).Write(buf, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||||
|
|
|
@ -36,7 +36,6 @@ var _ = Describe("Client", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
err := (&wire.Header{
|
err := (&wire.Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 1,
|
PacketNumber: 1,
|
||||||
PacketNumberLen: 1,
|
PacketNumberLen: 1,
|
||||||
}).Write(b, protocol.PerspectiveServer, protocol.VersionWhatever)
|
}).Write(b, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||||
|
@ -755,7 +754,6 @@ var _ = Describe("Client", func() {
|
||||||
PacketNumber: 1,
|
PacketNumber: 1,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
}
|
}
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
err := ph.Write(b, protocol.PerspectiveServer, cl.version)
|
err := ph.Write(b, protocol.PerspectiveServer, cl.version)
|
||||||
|
|
|
@ -81,7 +81,6 @@ var _ = Describe("Header", func() {
|
||||||
VersionFlag: true,
|
VersionFlag: true,
|
||||||
Version: versionPublicHeader,
|
Version: versionPublicHeader,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0x1337,
|
PacketNumber: 0x1337,
|
||||||
PacketNumberLen: protocol.PacketNumberLen4,
|
PacketNumberLen: protocol.PacketNumberLen4,
|
||||||
}).writePublicHeader(buf, protocol.PerspectiveClient, versionPublicHeader)
|
}).writePublicHeader(buf, protocol.PerspectiveClient, versionPublicHeader)
|
||||||
|
@ -89,7 +88,7 @@ var _ = Describe("Header", func() {
|
||||||
hdr, err := ParseHeaderSentByClient(bytes.NewReader(buf.Bytes()))
|
hdr, err := ParseHeaderSentByClient(bytes.NewReader(buf.Bytes()))
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(hdr.DestConnectionID).To(Equal(connID))
|
Expect(hdr.DestConnectionID).To(Equal(connID))
|
||||||
Expect(hdr.SrcConnectionID).To(Equal(connID))
|
Expect(hdr.SrcConnectionID).To(BeEmpty())
|
||||||
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0x1337)))
|
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0x1337)))
|
||||||
Expect(hdr.Version).To(Equal(versionPublicHeader))
|
Expect(hdr.Version).To(Equal(versionPublicHeader))
|
||||||
Expect(hdr.IsPublicHeader).To(BeTrue())
|
Expect(hdr.IsPublicHeader).To(BeTrue())
|
||||||
|
@ -100,7 +99,6 @@ var _ = Describe("Header", func() {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
err := (&Header{
|
err := (&Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0x1337,
|
PacketNumber: 0x1337,
|
||||||
PacketNumberLen: protocol.PacketNumberLen4,
|
PacketNumberLen: protocol.PacketNumberLen4,
|
||||||
DiversificationNonce: bytes.Repeat([]byte{'f'}, 32),
|
DiversificationNonce: bytes.Repeat([]byte{'f'}, 32),
|
||||||
|
@ -109,7 +107,7 @@ var _ = Describe("Header", func() {
|
||||||
hdr, err := ParseHeaderSentByServer(bytes.NewReader(buf.Bytes()))
|
hdr, err := ParseHeaderSentByServer(bytes.NewReader(buf.Bytes()))
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(hdr.DestConnectionID).To(Equal(connID))
|
Expect(hdr.DestConnectionID).To(Equal(connID))
|
||||||
Expect(hdr.SrcConnectionID).To(Equal(connID))
|
Expect(hdr.SrcConnectionID).To(BeEmpty())
|
||||||
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0x1337)))
|
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0x1337)))
|
||||||
Expect(hdr.DiversificationNonce).To(HaveLen(32))
|
Expect(hdr.DiversificationNonce).To(HaveLen(32))
|
||||||
Expect(hdr.IsPublicHeader).To(BeTrue())
|
Expect(hdr.IsPublicHeader).To(BeTrue())
|
||||||
|
@ -121,7 +119,6 @@ var _ = Describe("Header", func() {
|
||||||
VersionFlag: true,
|
VersionFlag: true,
|
||||||
Version: versionPublicHeader,
|
Version: versionPublicHeader,
|
||||||
DestConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
DestConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
||||||
SrcConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
|
||||||
PacketNumber: 0x1337,
|
PacketNumber: 0x1337,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
}).writePublicHeader(buf, protocol.PerspectiveClient, versionPublicHeader)
|
}).writePublicHeader(buf, protocol.PerspectiveClient, versionPublicHeader)
|
||||||
|
@ -145,7 +142,7 @@ var _ = Describe("Header", func() {
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(hdr.IsPublicHeader).To(BeTrue())
|
Expect(hdr.IsPublicHeader).To(BeTrue())
|
||||||
Expect(hdr.DestConnectionID).To(Equal(connID))
|
Expect(hdr.DestConnectionID).To(Equal(connID))
|
||||||
Expect(hdr.SrcConnectionID).To(Equal(connID))
|
Expect(hdr.SrcConnectionID).To(BeEmpty())
|
||||||
// in addition to the versions, the supported versions might contain a reserved version number
|
// in addition to the versions, the supported versions might contain a reserved version number
|
||||||
for _, version := range versions {
|
for _, version := range versions {
|
||||||
Expect(hdr.SupportedVersions).To(ContainElement(version))
|
Expect(hdr.SupportedVersions).To(ContainElement(version))
|
||||||
|
@ -177,7 +174,6 @@ var _ = Describe("Header", func() {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
hdr := &Header{
|
hdr := &Header{
|
||||||
DestConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
DestConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
||||||
SrcConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
|
||||||
PacketNumber: 0x42,
|
PacketNumber: 0x42,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
}
|
}
|
||||||
|
@ -211,7 +207,6 @@ var _ = Describe("Header", func() {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
hdr := &Header{
|
hdr := &Header{
|
||||||
DestConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
DestConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
||||||
SrcConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
|
||||||
PacketNumber: 0x42,
|
PacketNumber: 0x42,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
DiversificationNonce: bytes.Repeat([]byte{'f'}, 32),
|
DiversificationNonce: bytes.Repeat([]byte{'f'}, 32),
|
||||||
|
|
|
@ -27,10 +27,10 @@ func (h *Header) writePublicHeader(b *bytes.Buffer, pers protocol.Perspective, _
|
||||||
if h.VersionFlag && h.ResetFlag {
|
if h.VersionFlag && h.ResetFlag {
|
||||||
return errResetAndVersionFlagSet
|
return errResetAndVersionFlagSet
|
||||||
}
|
}
|
||||||
if !h.DestConnectionID.Equal(h.SrcConnectionID) {
|
if h.SrcConnectionID.Len() != 0 {
|
||||||
return fmt.Errorf("PublicHeader: SrcConnectionID must be equal to DestConnectionID")
|
return errors.New("PublicHeader: SrcConnectionID must not be set")
|
||||||
}
|
}
|
||||||
if len(h.DestConnectionID) != 8 {
|
if h.DestConnectionID.Len() != 8 {
|
||||||
return fmt.Errorf("PublicHeader: wrong length for Connection ID: %d (expected 8)", len(h.DestConnectionID))
|
return fmt.Errorf("PublicHeader: wrong length for Connection ID: %d (expected 8)", len(h.DestConnectionID))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,6 @@ func parsePublicHeader(b *bytes.Reader, packetSentBy protocol.Perspective) (*Hea
|
||||||
return nil, errInvalidConnectionID
|
return nil, errInvalidConnectionID
|
||||||
}
|
}
|
||||||
header.DestConnectionID = connID
|
header.DestConnectionID = connID
|
||||||
header.SrcConnectionID = connID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contrary to what the gQUIC wire spec says, the 0x4 bit only indicates the presence of the diversification nonce for packets sent by the server.
|
// Contrary to what the gQUIC wire spec says, the 0x4 bit only indicates the presence of the diversification nonce for packets sent by the server.
|
||||||
|
|
|
@ -28,7 +28,7 @@ var _ = Describe("Public Header", func() {
|
||||||
Expect(hdr.ResetFlag).To(BeFalse())
|
Expect(hdr.ResetFlag).To(BeFalse())
|
||||||
connID := protocol.ConnectionID{0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6}
|
connID := protocol.ConnectionID{0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6}
|
||||||
Expect(hdr.DestConnectionID).To(Equal(connID))
|
Expect(hdr.DestConnectionID).To(Equal(connID))
|
||||||
Expect(hdr.SrcConnectionID).To(Equal(connID))
|
Expect(hdr.SrcConnectionID).To(BeEmpty())
|
||||||
Expect(hdr.Version).To(Equal(protocol.SupportedVersions[0]))
|
Expect(hdr.Version).To(Equal(protocol.SupportedVersions[0]))
|
||||||
Expect(hdr.SupportedVersions).To(BeEmpty())
|
Expect(hdr.SupportedVersions).To(BeEmpty())
|
||||||
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(1)))
|
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(1)))
|
||||||
|
@ -65,7 +65,7 @@ var _ = Describe("Public Header", func() {
|
||||||
Expect(hdr.VersionFlag).To(BeFalse())
|
Expect(hdr.VersionFlag).To(BeFalse())
|
||||||
Expect(hdr.IsVersionNegotiation).To(BeFalse())
|
Expect(hdr.IsVersionNegotiation).To(BeFalse())
|
||||||
connID := protocol.ConnectionID{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8}
|
connID := protocol.ConnectionID{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8}
|
||||||
Expect(hdr.SrcConnectionID).To(Equal(connID))
|
Expect(hdr.SrcConnectionID).To(BeEmpty())
|
||||||
Expect(hdr.DestConnectionID).To(Equal(connID))
|
Expect(hdr.DestConnectionID).To(Equal(connID))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ var _ = Describe("Public Header", func() {
|
||||||
hdr, err := parsePublicHeader(b, protocol.PerspectiveServer)
|
hdr, err := parsePublicHeader(b, protocol.PerspectiveServer)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(hdr.DestConnectionID).ToNot(BeEmpty())
|
Expect(hdr.DestConnectionID).ToNot(BeEmpty())
|
||||||
Expect(hdr.SrcConnectionID).ToNot(BeEmpty())
|
Expect(hdr.SrcConnectionID).To(BeEmpty())
|
||||||
Expect(hdr.DiversificationNonce).To(Equal(divNonce))
|
Expect(hdr.DiversificationNonce).To(Equal(divNonce))
|
||||||
Expect(b.Len()).To(BeZero())
|
Expect(b.Len()).To(BeZero())
|
||||||
})
|
})
|
||||||
|
@ -95,7 +95,7 @@ var _ = Describe("Public Header", func() {
|
||||||
hdr, err := parsePublicHeader(b, protocol.PerspectiveServer)
|
hdr, err := parsePublicHeader(b, protocol.PerspectiveServer)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(hdr.DestConnectionID).To(Equal(connID))
|
Expect(hdr.DestConnectionID).To(Equal(connID))
|
||||||
Expect(hdr.SrcConnectionID).To(Equal(connID))
|
Expect(hdr.SrcConnectionID).To(BeEmpty())
|
||||||
Expect(hdr.VersionFlag).To(BeTrue())
|
Expect(hdr.VersionFlag).To(BeTrue())
|
||||||
Expect(hdr.Version).To(BeZero()) // unitialized
|
Expect(hdr.Version).To(BeZero()) // unitialized
|
||||||
Expect(hdr.IsVersionNegotiation).To(BeTrue())
|
Expect(hdr.IsVersionNegotiation).To(BeTrue())
|
||||||
|
@ -176,7 +176,6 @@ var _ = Describe("Public Header", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 2,
|
PacketNumber: 2,
|
||||||
PacketNumberLen: protocol.PacketNumberLen4,
|
PacketNumberLen: protocol.PacketNumberLen4,
|
||||||
}
|
}
|
||||||
|
@ -189,7 +188,6 @@ var _ = Describe("Public Header", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0x1337,
|
PacketNumber: 0x1337,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
}
|
}
|
||||||
|
@ -198,7 +196,7 @@ var _ = Describe("Public Header", func() {
|
||||||
Expect(b.Bytes()).To(Equal([]byte{0x18, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0x13, 0x37}))
|
Expect(b.Bytes()).To(Equal([]byte{0x18, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0x13, 0x37}))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("refuses to write a Public Header if the source and destination connection IDs are not matching", func() {
|
It("refuses to write a Public Header with a source connection ID", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
DestConnectionID: protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8},
|
||||||
|
@ -207,14 +205,13 @@ var _ = Describe("Public Header", func() {
|
||||||
PacketNumberLen: protocol.PacketNumberLen4,
|
PacketNumberLen: protocol.PacketNumberLen4,
|
||||||
}
|
}
|
||||||
err := hdr.writePublicHeader(b, protocol.PerspectiveClient, versionBigEndian)
|
err := hdr.writePublicHeader(b, protocol.PerspectiveClient, versionBigEndian)
|
||||||
Expect(err).To(MatchError("PublicHeader: SrcConnectionID must be equal to DestConnectionID"))
|
Expect(err).To(MatchError("PublicHeader: SrcConnectionID must not be set"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("refuses to write a Public Header if the connection ID has the wrong length", func() {
|
It("refuses to write a Public Header if the connection ID has the wrong length", func() {
|
||||||
connID := protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7}
|
connID := protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 2,
|
PacketNumber: 2,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
}
|
}
|
||||||
|
@ -227,7 +224,6 @@ var _ = Describe("Public Header", func() {
|
||||||
connID := protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8}
|
connID := protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 2,
|
PacketNumber: 2,
|
||||||
}
|
}
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
|
@ -240,7 +236,6 @@ var _ = Describe("Public Header", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
OmitConnectionID: true,
|
OmitConnectionID: true,
|
||||||
PacketNumberLen: protocol.PacketNumberLen1,
|
PacketNumberLen: protocol.PacketNumberLen1,
|
||||||
PacketNumber: 1,
|
PacketNumber: 1,
|
||||||
|
@ -254,7 +249,6 @@ var _ = Describe("Public Header", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 1,
|
PacketNumber: 1,
|
||||||
PacketNumberLen: protocol.PacketNumberLen1,
|
PacketNumberLen: protocol.PacketNumberLen1,
|
||||||
DiversificationNonce: bytes.Repeat([]byte{1}, 32),
|
DiversificationNonce: bytes.Repeat([]byte{1}, 32),
|
||||||
|
@ -283,7 +277,6 @@ var _ = Describe("Public Header", func() {
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
VersionFlag: true,
|
VersionFlag: true,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 2,
|
PacketNumber: 2,
|
||||||
PacketNumberLen: protocol.PacketNumberLen6,
|
PacketNumberLen: protocol.PacketNumberLen6,
|
||||||
}
|
}
|
||||||
|
@ -297,7 +290,6 @@ var _ = Describe("Public Header", func() {
|
||||||
VersionFlag: true,
|
VersionFlag: true,
|
||||||
Version: protocol.Version39,
|
Version: protocol.Version39,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0x42,
|
PacketNumber: 0x42,
|
||||||
PacketNumberLen: protocol.PacketNumberLen1,
|
PacketNumberLen: protocol.PacketNumberLen1,
|
||||||
}
|
}
|
||||||
|
@ -315,11 +307,9 @@ var _ = Describe("Public Header", func() {
|
||||||
Context("PublicReset packets", func() {
|
Context("PublicReset packets", func() {
|
||||||
It("sets the Reset Flag", func() {
|
It("sets the Reset Flag", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
connID := protocol.ConnectionID{0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6}
|
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
ResetFlag: true,
|
ResetFlag: true,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: protocol.ConnectionID{0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6},
|
||||||
SrcConnectionID: connID,
|
|
||||||
}
|
}
|
||||||
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, protocol.VersionWhatever)
|
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
@ -331,11 +321,9 @@ var _ = Describe("Public Header", func() {
|
||||||
|
|
||||||
It("doesn't add a packet number for headers with Reset Flag sent as a client", func() {
|
It("doesn't add a packet number for headers with Reset Flag sent as a client", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
connID := protocol.ConnectionID{0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6}
|
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
ResetFlag: true,
|
ResetFlag: true,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: protocol.ConnectionID{0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6},
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 2,
|
PacketNumber: 2,
|
||||||
PacketNumberLen: protocol.PacketNumberLen6,
|
PacketNumberLen: protocol.PacketNumberLen6,
|
||||||
}
|
}
|
||||||
|
@ -365,7 +353,6 @@ var _ = Describe("Public Header", func() {
|
||||||
It("errors when PacketNumberLen is not set", func() {
|
It("errors when PacketNumberLen is not set", func() {
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0xdecafbad,
|
PacketNumber: 0xdecafbad,
|
||||||
}
|
}
|
||||||
_, err := hdr.getPublicHeaderLength(protocol.PerspectiveServer)
|
_, err := hdr.getPublicHeaderLength(protocol.PerspectiveServer)
|
||||||
|
@ -375,7 +362,6 @@ var _ = Describe("Public Header", func() {
|
||||||
It("gets the length of a packet with longest packet number length and connectionID", func() {
|
It("gets the length of a packet with longest packet number length and connectionID", func() {
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0xdecafbad,
|
PacketNumber: 0xdecafbad,
|
||||||
PacketNumberLen: protocol.PacketNumberLen4,
|
PacketNumberLen: protocol.PacketNumberLen4,
|
||||||
}
|
}
|
||||||
|
@ -387,7 +373,6 @@ var _ = Describe("Public Header", func() {
|
||||||
It("gets the lengths of a packet sent by the client with the VersionFlag set", func() {
|
It("gets the lengths of a packet sent by the client with the VersionFlag set", func() {
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
OmitConnectionID: true,
|
OmitConnectionID: true,
|
||||||
PacketNumber: 0xdecafbad,
|
PacketNumber: 0xdecafbad,
|
||||||
PacketNumberLen: protocol.PacketNumberLen4,
|
PacketNumberLen: protocol.PacketNumberLen4,
|
||||||
|
@ -402,7 +387,6 @@ var _ = Describe("Public Header", func() {
|
||||||
It("gets the length of a packet with longest packet number length and omitted connectionID", func() {
|
It("gets the length of a packet with longest packet number length and omitted connectionID", func() {
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
OmitConnectionID: true,
|
OmitConnectionID: true,
|
||||||
PacketNumber: 0xDECAFBAD,
|
PacketNumber: 0xDECAFBAD,
|
||||||
PacketNumberLen: protocol.PacketNumberLen4,
|
PacketNumberLen: protocol.PacketNumberLen4,
|
||||||
|
@ -415,7 +399,6 @@ var _ = Describe("Public Header", func() {
|
||||||
It("gets the length of a packet 2 byte packet number length ", func() {
|
It("gets the length of a packet 2 byte packet number length ", func() {
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0xDECAFBAD,
|
PacketNumber: 0xDECAFBAD,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
}
|
}
|
||||||
|
@ -438,7 +421,6 @@ var _ = Describe("Public Header", func() {
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
ResetFlag: true,
|
ResetFlag: true,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
}
|
}
|
||||||
length, err := hdr.getPublicHeaderLength(protocol.PerspectiveServer)
|
length, err := hdr.getPublicHeaderLength(protocol.PerspectiveServer)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
@ -451,7 +433,6 @@ var _ = Describe("Public Header", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0xDECAFBAD,
|
PacketNumber: 0xDECAFBAD,
|
||||||
}
|
}
|
||||||
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, protocol.VersionWhatever)
|
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, protocol.VersionWhatever)
|
||||||
|
@ -465,7 +446,6 @@ var _ = Describe("Public Header", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0xdecafbad,
|
PacketNumber: 0xdecafbad,
|
||||||
PacketNumberLen: protocol.PacketNumberLen1,
|
PacketNumberLen: protocol.PacketNumberLen1,
|
||||||
}
|
}
|
||||||
|
@ -478,7 +458,6 @@ var _ = Describe("Public Header", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0xdecafbad,
|
PacketNumber: 0xdecafbad,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
}
|
}
|
||||||
|
@ -491,7 +470,6 @@ var _ = Describe("Public Header", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0x13decafbad,
|
PacketNumber: 0x13decafbad,
|
||||||
PacketNumberLen: protocol.PacketNumberLen4,
|
PacketNumberLen: protocol.PacketNumberLen4,
|
||||||
}
|
}
|
||||||
|
@ -504,7 +482,6 @@ var _ = Describe("Public Header", func() {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
hdr := Header{
|
hdr := Header{
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 0xbe1337decafbad,
|
PacketNumber: 0xbe1337decafbad,
|
||||||
PacketNumberLen: protocol.PacketNumberLen6,
|
PacketNumberLen: protocol.PacketNumberLen6,
|
||||||
}
|
}
|
||||||
|
@ -535,7 +512,6 @@ var _ = Describe("Public Header", func() {
|
||||||
It("logs a Public Header containing a connection ID", func() {
|
It("logs a Public Header containing a connection ID", func() {
|
||||||
(&Header{
|
(&Header{
|
||||||
DestConnectionID: protocol.ConnectionID{0x13, 0x37, 0, 0, 0xde, 0xca, 0xfb, 0xad},
|
DestConnectionID: protocol.ConnectionID{0x13, 0x37, 0, 0, 0xde, 0xca, 0xfb, 0xad},
|
||||||
SrcConnectionID: protocol.ConnectionID{0x13, 0x37, 0, 0, 0xde, 0xca, 0xfb, 0xad},
|
|
||||||
PacketNumber: 0x1337,
|
PacketNumber: 0x1337,
|
||||||
PacketNumberLen: 6,
|
PacketNumberLen: 6,
|
||||||
Version: protocol.Version39,
|
Version: protocol.Version39,
|
||||||
|
@ -565,7 +541,6 @@ var _ = Describe("Public Header", func() {
|
||||||
It("logs diversification nonces", func() {
|
It("logs diversification nonces", func() {
|
||||||
(&Header{
|
(&Header{
|
||||||
DestConnectionID: []byte{0x13, 0x13, 0, 0, 0xde, 0xca, 0xfb, 0xad},
|
DestConnectionID: []byte{0x13, 0x13, 0, 0, 0xde, 0xca, 0xfb, 0xad},
|
||||||
SrcConnectionID: []byte{0x13, 0x13, 0, 0, 0xde, 0xca, 0xfb, 0xad},
|
|
||||||
DiversificationNonce: []byte{0xba, 0xdf, 0x00, 0x0d},
|
DiversificationNonce: []byte{0xba, 0xdf, 0x00, 0x0d},
|
||||||
}).logPublicHeader(logger)
|
}).logPublicHeader(logger)
|
||||||
Expect(buf.String()).To(ContainSubstring("DiversificationNonce: []byte{0xba, 0xdf, 0x0, 0xd}"))
|
Expect(buf.String()).To(ContainSubstring("DiversificationNonce: []byte{0xba, 0xdf, 0x0, 0xd}"))
|
||||||
|
|
|
@ -17,7 +17,7 @@ var _ = Describe("Version Negotiation Packets", func() {
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(hdr.VersionFlag).To(BeTrue())
|
Expect(hdr.VersionFlag).To(BeTrue())
|
||||||
Expect(hdr.DestConnectionID).To(Equal(connID))
|
Expect(hdr.DestConnectionID).To(Equal(connID))
|
||||||
Expect(hdr.SrcConnectionID).To(Equal(connID))
|
Expect(hdr.SrcConnectionID).To(BeEmpty())
|
||||||
Expect(hdr.SupportedVersions).To(Equal(versions))
|
Expect(hdr.SupportedVersions).To(Equal(versions))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -452,13 +452,13 @@ func (p *packetPacker) getHeader(encLevel protocol.EncryptionLevel) *wire.Header
|
||||||
|
|
||||||
header := &wire.Header{
|
header := &wire.Header{
|
||||||
DestConnectionID: p.destConnID,
|
DestConnectionID: p.destConnID,
|
||||||
SrcConnectionID: p.srcConnID,
|
|
||||||
PacketNumber: pnum,
|
PacketNumber: pnum,
|
||||||
PacketNumberLen: packetNumberLen,
|
PacketNumberLen: packetNumberLen,
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.version.UsesTLS() && encLevel != protocol.EncryptionForwardSecure {
|
if p.version.UsesTLS() && encLevel != protocol.EncryptionForwardSecure {
|
||||||
header.IsLongHeader = true
|
header.IsLongHeader = true
|
||||||
|
header.SrcConnectionID = p.srcConnID
|
||||||
// Set the payload len to maximum size.
|
// Set the payload len to maximum size.
|
||||||
// Since it is encoded as a varint, this guarantees us that the header will end up at most as big as GetLength() returns.
|
// Since it is encoded as a varint, this guarantees us that the header will end up at most as big as GetLength() returns.
|
||||||
header.PayloadLen = p.maxPacketSize
|
header.PayloadLen = p.maxPacketSize
|
||||||
|
|
|
@ -158,6 +158,11 @@ var _ = Describe("Packet packer", func() {
|
||||||
packer.version = versionPublicHeader
|
packer.version = versionPublicHeader
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("doesn't set the source connection ID", func() {
|
||||||
|
ph := packer.getHeader(protocol.EncryptionForwardSecure)
|
||||||
|
Expect(ph.SrcConnectionID).To(BeEmpty())
|
||||||
|
})
|
||||||
|
|
||||||
It("it omits the connection ID for forward-secure packets", func() {
|
It("it omits the connection ID for forward-secure packets", func() {
|
||||||
ph := packer.getHeader(protocol.EncryptionForwardSecure)
|
ph := packer.getHeader(protocol.EncryptionForwardSecure)
|
||||||
Expect(ph.OmitConnectionID).To(BeFalse())
|
Expect(ph.OmitConnectionID).To(BeFalse())
|
||||||
|
|
|
@ -393,7 +393,7 @@ func (s *server) handleGQUICPacket(hdr *wire.Header, packetData []byte, remoteAd
|
||||||
return errors.New("dropping small packet with unknown version")
|
return errors.New("dropping small packet with unknown version")
|
||||||
}
|
}
|
||||||
s.logger.Infof("Client offered version %s, sending Version Negotiation Packet", hdr.Version)
|
s.logger.Infof("Client offered version %s, sending Version Negotiation Packet", hdr.Version)
|
||||||
_, err := s.conn.WriteTo(wire.ComposeGQUICVersionNegotiation(hdr.SrcConnectionID, s.config.Versions), remoteAddr)
|
_, err := s.conn.WriteTo(wire.ComposeGQUICVersionNegotiation(hdr.DestConnectionID, s.config.Versions), remoteAddr)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -371,11 +371,10 @@ var _ = Describe("Server", func() {
|
||||||
hdr := wire.Header{
|
hdr := wire.Header{
|
||||||
VersionFlag: true,
|
VersionFlag: true,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 1,
|
PacketNumber: 1,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
}
|
}
|
||||||
hdr.Write(b, protocol.PerspectiveClient, 13 /* not a valid QUIC version */)
|
Expect(hdr.Write(b, protocol.PerspectiveClient, 13 /* not a valid QUIC version */)).To(Succeed())
|
||||||
b.Write(bytes.Repeat([]byte{0}, protocol.MinClientHelloSize)) // add a fake CHLO
|
b.Write(bytes.Repeat([]byte{0}, protocol.MinClientHelloSize)) // add a fake CHLO
|
||||||
serv.conn = conn
|
serv.conn = conn
|
||||||
sessionHandler.EXPECT().Get(connID)
|
sessionHandler.EXPECT().Get(connID)
|
||||||
|
@ -389,11 +388,10 @@ var _ = Describe("Server", func() {
|
||||||
hdr := wire.Header{
|
hdr := wire.Header{
|
||||||
VersionFlag: true,
|
VersionFlag: true,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 1,
|
PacketNumber: 1,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
}
|
}
|
||||||
hdr.Write(b, protocol.PerspectiveClient, 13 /* not a valid QUIC version */)
|
Expect(hdr.Write(b, protocol.PerspectiveClient, 13 /* not a valid QUIC version */)).To(Succeed())
|
||||||
b.Write(bytes.Repeat([]byte{0}, protocol.MinClientHelloSize-1)) // this packet is 1 byte too small
|
b.Write(bytes.Repeat([]byte{0}, protocol.MinClientHelloSize-1)) // this packet is 1 byte too small
|
||||||
serv.conn = conn
|
serv.conn = conn
|
||||||
sessionHandler.EXPECT().Get(connID)
|
sessionHandler.EXPECT().Get(connID)
|
||||||
|
@ -468,11 +466,10 @@ var _ = Describe("Server", func() {
|
||||||
hdr := wire.Header{
|
hdr := wire.Header{
|
||||||
VersionFlag: true,
|
VersionFlag: true,
|
||||||
DestConnectionID: connID,
|
DestConnectionID: connID,
|
||||||
SrcConnectionID: connID,
|
|
||||||
PacketNumber: 1,
|
PacketNumber: 1,
|
||||||
PacketNumberLen: protocol.PacketNumberLen2,
|
PacketNumberLen: protocol.PacketNumberLen2,
|
||||||
}
|
}
|
||||||
hdr.Write(b, protocol.PerspectiveClient, 13 /* not a valid QUIC version */)
|
Expect(hdr.Write(b, protocol.PerspectiveClient, 13 /* not a valid QUIC version */)).To(Succeed())
|
||||||
b.Write(bytes.Repeat([]byte{0}, protocol.MinClientHelloSize)) // add a fake CHLO
|
b.Write(bytes.Repeat([]byte{0}, protocol.MinClientHelloSize)) // add a fake CHLO
|
||||||
conn.dataToRead <- b.Bytes()
|
conn.dataToRead <- b.Bytes()
|
||||||
conn.dataReadFrom = udpAddr
|
conn.dataReadFrom = udpAddr
|
||||||
|
@ -485,7 +482,6 @@ var _ = Describe("Server", func() {
|
||||||
ln.Accept()
|
ln.Accept()
|
||||||
close(done)
|
close(done)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
Eventually(func() int { return conn.dataWritten.Len() }).ShouldNot(BeZero())
|
Eventually(func() int { return conn.dataWritten.Len() }).ShouldNot(BeZero())
|
||||||
Expect(conn.dataWrittenTo).To(Equal(udpAddr))
|
Expect(conn.dataWrittenTo).To(Equal(udpAddr))
|
||||||
r := bytes.NewReader(conn.dataWritten.Bytes())
|
r := bytes.NewReader(conn.dataWritten.Bytes())
|
||||||
|
@ -493,7 +489,6 @@ var _ = Describe("Server", func() {
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(packet.VersionFlag).To(BeTrue())
|
Expect(packet.VersionFlag).To(BeTrue())
|
||||||
Expect(packet.DestConnectionID).To(Equal(connID))
|
Expect(packet.DestConnectionID).To(Equal(connID))
|
||||||
Expect(packet.SrcConnectionID).To(Equal(connID))
|
|
||||||
Expect(r.Len()).To(BeZero())
|
Expect(r.Len()).To(BeZero())
|
||||||
Consistently(done).ShouldNot(BeClosed())
|
Consistently(done).ShouldNot(BeClosed())
|
||||||
// make the go routine return
|
// make the go routine return
|
||||||
|
|
|
@ -205,7 +205,7 @@ func newSession(
|
||||||
s.streamFramer = newStreamFramer(s.cryptoStream, s.streamsMap, s.version)
|
s.streamFramer = newStreamFramer(s.cryptoStream, s.streamsMap, s.version)
|
||||||
s.packer = newPacketPacker(
|
s.packer = newPacketPacker(
|
||||||
connectionID,
|
connectionID,
|
||||||
connectionID,
|
nil, // no src connection ID
|
||||||
1,
|
1,
|
||||||
s.sentPacketHandler.GetPacketNumberLen,
|
s.sentPacketHandler.GetPacketNumberLen,
|
||||||
s.RemoteAddr(),
|
s.RemoteAddr(),
|
||||||
|
@ -275,7 +275,7 @@ var newClientSession = func(
|
||||||
s.streamFramer = newStreamFramer(s.cryptoStream, s.streamsMap, s.version)
|
s.streamFramer = newStreamFramer(s.cryptoStream, s.streamsMap, s.version)
|
||||||
s.packer = newPacketPacker(
|
s.packer = newPacketPacker(
|
||||||
connectionID,
|
connectionID,
|
||||||
connectionID,
|
nil, // no src connection ID
|
||||||
1,
|
1,
|
||||||
s.sentPacketHandler.GetPacketNumberLen,
|
s.sentPacketHandler.GetPacketNumberLen,
|
||||||
s.RemoteAddr(),
|
s.RemoteAddr(),
|
||||||
|
@ -643,7 +643,7 @@ func (s *session) handlePacketImpl(p *receivedPacket) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The server can change the source connection ID with the first Handshake packet.
|
// The server can change the source connection ID with the first Handshake packet.
|
||||||
if s.perspective == protocol.PerspectiveClient && !s.receivedFirstPacket && !hdr.SrcConnectionID.Equal(s.destConnID) {
|
if s.perspective == protocol.PerspectiveClient && !s.receivedFirstPacket && hdr.IsLongHeader && !hdr.SrcConnectionID.Equal(s.destConnID) {
|
||||||
s.logger.Debugf("Received first packet. Switching destination connection ID to: %s", hdr.SrcConnectionID)
|
s.logger.Debugf("Received first packet. Switching destination connection ID to: %s", hdr.SrcConnectionID)
|
||||||
s.destConnID = hdr.SrcConnectionID
|
s.destConnID = hdr.SrcConnectionID
|
||||||
s.packer.ChangeDestConnectionID(s.destConnID)
|
s.packer.ChangeDestConnectionID(s.destConnID)
|
||||||
|
|
|
@ -1124,6 +1124,7 @@ var _ = Describe("Session", func() {
|
||||||
It("retransmits an unencrypted packet, and doesn't add a STOP_WAITING frame (for IETF QUIC)", func() {
|
It("retransmits an unencrypted packet, and doesn't add a STOP_WAITING frame (for IETF QUIC)", func() {
|
||||||
sess.version = versionIETFFrames
|
sess.version = versionIETFFrames
|
||||||
sess.packer.version = versionIETFFrames
|
sess.packer.version = versionIETFFrames
|
||||||
|
sess.packer.srcConnID = sess.destConnID
|
||||||
sf := &wire.StreamFrame{StreamID: 1, Data: []byte("foobar")}
|
sf := &wire.StreamFrame{StreamID: 1, Data: []byte("foobar")}
|
||||||
sph.EXPECT().DequeuePacketForRetransmission().Return(&ackhandler.Packet{
|
sph.EXPECT().DequeuePacketForRetransmission().Return(&ackhandler.Packet{
|
||||||
PacketNumber: 1337,
|
PacketNumber: 1337,
|
||||||
|
@ -1799,6 +1800,7 @@ var _ = Describe("Client Session", func() {
|
||||||
It("changes the connection ID when receiving the first packet from the server", func() {
|
It("changes the connection ID when receiving the first packet from the server", func() {
|
||||||
sess.version = protocol.VersionTLS
|
sess.version = protocol.VersionTLS
|
||||||
sess.packer.version = protocol.VersionTLS
|
sess.packer.version = protocol.VersionTLS
|
||||||
|
sess.packer.srcConnID = sess.destConnID
|
||||||
unpacker := NewMockUnpacker(mockCtrl)
|
unpacker := NewMockUnpacker(mockCtrl)
|
||||||
unpacker.EXPECT().Unpack(gomock.Any(), gomock.Any(), gomock.Any()).Return(&unpackedPacket{}, nil)
|
unpacker.EXPECT().Unpack(gomock.Any(), gomock.Any(), gomock.Any()).Return(&unpackedPacket{}, nil)
|
||||||
sess.unpacker = unpacker
|
sess.unpacker = unpacker
|
||||||
|
@ -1808,6 +1810,7 @@ var _ = Describe("Client Session", func() {
|
||||||
}()
|
}()
|
||||||
err := sess.handlePacketImpl(&receivedPacket{
|
err := sess.handlePacketImpl(&receivedPacket{
|
||||||
header: &wire.Header{
|
header: &wire.Header{
|
||||||
|
IsLongHeader: true,
|
||||||
Type: protocol.PacketTypeHandshake,
|
Type: protocol.PacketTypeHandshake,
|
||||||
SrcConnectionID: protocol.ConnectionID{1, 3, 3, 7, 1, 3, 3, 7},
|
SrcConnectionID: protocol.ConnectionID{1, 3, 3, 7, 1, 3, 3, 7},
|
||||||
DestConnectionID: sess.srcConnID,
|
DestConnectionID: sess.srcConnID,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue