remove the OmitConnectionID field from the Header struct

Instead, just look at the length of the destination connection ID.
This commit is contained in:
Marten Seemann
2018-06-24 17:11:25 +07:00
parent fc57bf6c35
commit 7b96d158d2
9 changed files with 60 additions and 105 deletions

View File

@@ -165,16 +165,16 @@ var _ = Describe("Packet packer", func() {
It("it omits the connection ID for forward-secure packets", func() {
ph := packer.getHeader(protocol.EncryptionForwardSecure)
Expect(ph.OmitConnectionID).To(BeFalse())
Expect(ph.DestConnectionID.Len()).ToNot(BeZero())
packer.SetOmitConnectionID()
ph = packer.getHeader(protocol.EncryptionForwardSecure)
Expect(ph.OmitConnectionID).To(BeTrue())
Expect(ph.DestConnectionID.Len()).To(BeZero())
})
It("doesn't omit the connection ID for non-forward-secure packets", func() {
packer.SetOmitConnectionID()
ph := packer.getHeader(protocol.EncryptionSecure)
Expect(ph.OmitConnectionID).To(BeFalse())
Expect(ph.DestConnectionID.Len()).ToNot(BeZero())
})
It("adds the Version Flag to the Public Header before the crypto handshake is finished", func() {
@@ -254,20 +254,6 @@ var _ = Describe("Packet packer", func() {
Expect(h.IsLongHeader).To(BeFalse())
Expect(h.PacketNumberLen).To(BeNumerically(">", 0))
})
It("it omits the connection ID for forward-secure packets", func() {
h := packer.getHeader(protocol.EncryptionForwardSecure)
Expect(h.OmitConnectionID).To(BeFalse())
packer.SetOmitConnectionID()
h = packer.getHeader(protocol.EncryptionForwardSecure)
Expect(h.OmitConnectionID).To(BeTrue())
})
It("doesn't omit the connection ID for non-forward-secure packets", func() {
packer.SetOmitConnectionID()
h := packer.getHeader(protocol.EncryptionSecure)
Expect(h.OmitConnectionID).To(BeFalse())
})
})
})