forked from quic-go/quic-go
read the ECN bits
This commit is contained in:
@@ -37,10 +37,10 @@ func (t PacketType) String() string {
|
||||
type ECN uint8
|
||||
|
||||
const (
|
||||
ECNNon ECN = iota
|
||||
ECT0
|
||||
ECT1
|
||||
ECNCE
|
||||
ECNNon ECN = iota // 00
|
||||
ECT1 // 01
|
||||
ECT0 // 10
|
||||
ECNCE // 11
|
||||
)
|
||||
|
||||
// A ByteCount in QUIC
|
||||
|
||||
@@ -15,4 +15,11 @@ var _ = Describe("Protocol", func() {
|
||||
Expect(PacketType(10).String()).To(Equal("unknown packet type: 10"))
|
||||
})
|
||||
})
|
||||
|
||||
It("converts ECN bits from the IP header wire to the correct types", func() {
|
||||
Expect(ECN(0)).To(Equal(ECNNon))
|
||||
Expect(ECN(0b00000010)).To(Equal(ECT0))
|
||||
Expect(ECN(0b00000001)).To(Equal(ECT1))
|
||||
Expect(ECN(0b00000011)).To(Equal(ECNCE))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user