mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
move parsing of version negotiation packets to the wire.Header
This commit is contained in:
parent
5581fee684
commit
9bcedd988d
15 changed files with 167 additions and 176 deletions
|
@ -16,19 +16,17 @@ var _ = Describe("Version Negotiation Packets", func() {
|
|||
data, err := ComposeVersionNegotiation(destConnID, srcConnID, versions)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(data[0] & 0x80).ToNot(BeZero())
|
||||
hdr, err := ParseHeader(bytes.NewReader(data), 4)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
b := bytes.NewReader(data)
|
||||
extHdr, err := hdr.Parse(b, versionIETFFrames)
|
||||
hdr, err := ParseHeader(b, 4)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(extHdr.IsVersionNegotiation).To(BeTrue())
|
||||
Expect(extHdr.DestConnectionID).To(Equal(destConnID))
|
||||
Expect(extHdr.SrcConnectionID).To(Equal(srcConnID))
|
||||
Expect(extHdr.Version).To(BeZero())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(hdr.DestConnectionID).To(Equal(destConnID))
|
||||
Expect(hdr.SrcConnectionID).To(Equal(srcConnID))
|
||||
Expect(hdr.Version).To(BeZero())
|
||||
// the supported versions should include one reserved version number
|
||||
Expect(extHdr.SupportedVersions).To(HaveLen(len(versions) + 1))
|
||||
Expect(hdr.SupportedVersions).To(HaveLen(len(versions) + 1))
|
||||
for _, version := range versions {
|
||||
Expect(extHdr.SupportedVersions).To(ContainElement(version))
|
||||
Expect(hdr.SupportedVersions).To(ContainElement(version))
|
||||
}
|
||||
Expect(b.Len()).To(BeZero())
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue