add a type for the key phase and use it for header parsing and writing

This commit is contained in:
Marten Seemann 2019-05-30 18:08:16 +08:00
parent 4de3a09ec4
commit 14a31d49a0
5 changed files with 47 additions and 9 deletions

View file

@ -199,7 +199,7 @@ var _ = Describe("Header", func() {
It("writes the Key Phase Bit", func() {
Expect((&ExtendedHeader{
KeyPhase: 1,
KeyPhase: protocol.KeyPhaseOne,
PacketNumberLen: protocol.PacketNumberLen1,
PacketNumber: 0x42,
}).Write(buf, versionIETFHeader)).To(Succeed())
@ -407,7 +407,7 @@ var _ = Describe("Header", func() {
Header: Header{
DestConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef, 0xca, 0xfe, 0x13, 0x37},
},
KeyPhase: 1,
KeyPhase: protocol.KeyPhaseOne,
PacketNumber: 0x1337,
PacketNumberLen: 4,
}).Log(logger)