github.com/TugasAkhir-QUIC/quic-go@v0.0.2-0.20240215011318-d20e25a9054c/logging/packet_header.go (about) 1 package logging 2 3 import ( 4 "github.com/TugasAkhir-QUIC/quic-go/internal/protocol" 5 ) 6 7 // PacketTypeFromHeader determines the packet type from a *wire.Header. 8 func PacketTypeFromHeader(hdr *Header) PacketType { 9 if hdr.Version == 0 { 10 return PacketTypeVersionNegotiation 11 } 12 switch hdr.Type { 13 case protocol.PacketTypeInitial: 14 return PacketTypeInitial 15 case protocol.PacketTypeHandshake: 16 return PacketTypeHandshake 17 case protocol.PacketType0RTT: 18 return PacketType0RTT 19 case protocol.PacketTypeRetry: 20 return PacketTypeRetry 21 default: 22 return PacketTypeNotDetermined 23 } 24 }