when parsing the header from the invariant header, start from first byte

This will be needed once we implement header encryption, because the
flags in the first byte are encrypted.
This commit is contained in:
Marten Seemann 2018-11-20 11:36:27 +07:00
parent 8856384b83
commit cef26922b4
7 changed files with 55 additions and 39 deletions

View file

@ -16,9 +16,9 @@ var _ = Describe("Version Negotiation Packets", func() {
data, err := ComposeVersionNegotiation(destConnID, srcConnID, versions)
Expect(err).ToNot(HaveOccurred())
Expect(data[0] & 0x80).ToNot(BeZero())
b := bytes.NewReader(data)
iHdr, err := ParseInvariantHeader(b, 4)
iHdr, err := ParseInvariantHeader(bytes.NewReader(data), 4)
Expect(err).ToNot(HaveOccurred())
b := bytes.NewReader(data)
hdr, err := iHdr.Parse(b, versionIETFFrames)
Expect(err).ToNot(HaveOccurred())
Expect(hdr.IsVersionNegotiation).To(BeTrue())
@ -30,5 +30,6 @@ var _ = Describe("Version Negotiation Packets", func() {
for _, version := range versions {
Expect(hdr.SupportedVersions).To(ContainElement(version))
}
Expect(b.Len()).To(BeZero())
})
})