determine the packet type from the QUIC header

This commit is contained in:
Marten Seemann
2020-01-21 12:24:15 +07:00
parent e6d55ac467
commit bfd745106c
4 changed files with 184 additions and 67 deletions

View File

@@ -60,3 +60,33 @@ func (c category) String() string {
panic("unknown category")
}
}
type packetType protocol.PacketType
const (
packetTypeInitial packetType = iota
packetTypeHandshake
packetTypeRetry
packetType0RTT
packetTypeVersionNegotiation
packetType1RTT
)
func (t packetType) String() string {
switch t {
case packetTypeInitial:
return "initial"
case packetTypeHandshake:
return "handshake"
case packetTypeRetry:
return "retry"
case packetType0RTT:
return "0RTT"
case packetTypeVersionNegotiation:
return "version_negotiation"
case packetType1RTT:
return "1RTT"
default:
panic("unknown packet type")
}
}