uquic/logging/packet_header.go
Gaukas Wang 95575f5fe7
break: update repo url [ci skip]
uTLS is not yet bumped to the new version, so this commit breaks the dependencies relationship by getting rid of the local replace.
2023-08-03 18:58:52 -06:00

24 lines
582 B
Go

package logging
import (
"github.com/refraction-networking/uquic/internal/protocol"
)
// PacketTypeFromHeader determines the packet type from a *wire.Header.
func PacketTypeFromHeader(hdr *Header) PacketType {
if hdr.Version == 0 {
return PacketTypeVersionNegotiation
}
switch hdr.Type {
case protocol.PacketTypeInitial:
return PacketTypeInitial
case protocol.PacketTypeHandshake:
return PacketTypeHandshake
case protocol.PacketType0RTT:
return PacketType0RTT
case protocol.PacketTypeRetry:
return PacketTypeRetry
default:
return PacketTypeNotDetermined
}
}