Source File
protocol.go
Belonging Package
github.com/quic-go/quic-go/internal/protocol
package protocolimport ()// The PacketType is the Long Header Typetype PacketType uint8const (// PacketTypeInitial is the packet type of an Initial packetPacketTypeInitial PacketType = 1 + iota// PacketTypeRetry is the packet type of a Retry packetPacketTypeRetry// PacketTypeHandshake is the packet type of a Handshake packetPacketTypeHandshake// PacketType0RTT is the packet type of a 0-RTT packetPacketType0RTT)func ( PacketType) () string {switch {case PacketTypeInitial:return "Initial"case PacketTypeRetry:return "Retry"case PacketTypeHandshake:return "Handshake"case PacketType0RTT:return "0-RTT Protected"default:return fmt.Sprintf("unknown packet type: %d", )}}type ECN uint8const (ECNUnsupported ECN = iotaECNNon // 00ECT1 // 01ECT0 // 10ECNCE // 11)func ( byte) ECN {switch {case 0:return ECNNoncase 0b00000010:return ECT0case 0b00000001:return ECT1case 0b00000011:return ECNCEdefault:panic("invalid ECN bits")}}func ( ECN) () byte {//nolint:exhaustive // There are only 4 values.switch {case ECNNon:return 0case ECT0:return 0b00000010case ECT1:return 0b00000001case ECNCE:return 0b00000011default:panic("ECN unsupported")}}func ( ECN) () string {switch {case ECNUnsupported:return "ECN unsupported"case ECNNon:return "Not-ECT"case ECT1:return "ECT(1)"case ECT0:return "ECT(0)"case ECNCE:return "CE"default:return fmt.Sprintf("invalid ECN value: %d", )}}// A ByteCount in QUICtype ByteCount int64type AtomicByteCount atomic.Int64// MaxByteCount is the maximum value of a ByteCountconst MaxByteCount = ByteCount(1<<62 - 1)// InvalidByteCount is an invalid byte countconst InvalidByteCount ByteCount = -1// A StatelessResetToken is a stateless reset token.type StatelessResetToken [16]byte// MaxPacketBufferSize maximum packet size of any QUIC packet, based on// ethernet's max size, minus the IP and UDP headers. IPv6 has a 40 byte header,// UDP adds an additional 8 bytes. This is a total overhead of 48 bytes.// Ethernet's max packet size is 1500 bytes, 1500 - 48 = 1452.const MaxPacketBufferSize = 1452// MaxLargePacketBufferSize is used when using GSOconst MaxLargePacketBufferSize = 20 * 1024// MinInitialPacketSize is the minimum size an Initial packet is required to have.const MinInitialPacketSize = 1200// MinUnknownVersionPacketSize is the minimum size a packet with an unknown version// needs to have in order to trigger a Version Negotiation packet.const MinUnknownVersionPacketSize = MinInitialPacketSize// MinStatelessResetSize is the minimum size of a stateless reset packet that we sendconst MinStatelessResetSize = 1 /* first byte */ + 20 /* max. conn ID length */ + 4 /* max. packet number length */ + 1 /* min. payload length */ + 16 /* token */// MinReceivedStatelessResetSize is the minimum size of a received stateless reset,// as specified in section 10.3 of RFC 9000.const MinReceivedStatelessResetSize = 5 + 16// MinConnectionIDLenInitial is the minimum length of the destination connection ID on an Initial packet.const MinConnectionIDLenInitial = 8// DefaultAckDelayExponent is the default ack delay exponentconst DefaultAckDelayExponent = 3// DefaultActiveConnectionIDLimit is the default active connection ID limitconst DefaultActiveConnectionIDLimit = 2// MaxAckDelayExponent is the maximum ack delay exponentconst MaxAckDelayExponent = 20// DefaultMaxAckDelay is the default max_ack_delayconst DefaultMaxAckDelay = 25 * time.Millisecond// MaxMaxAckDelay is the maximum max_ack_delayconst MaxMaxAckDelay = (1<<14 - 1) * time.Millisecond// MaxConnIDLen is the maximum length of the connection IDconst MaxConnIDLen = 20// InvalidPacketLimitAES is the maximum number of packets that we can fail to decrypt when using// AEAD_AES_128_GCM or AEAD_AES_265_GCM.const InvalidPacketLimitAES = 1 << 52// InvalidPacketLimitChaCha is the maximum number of packets that we can fail to decrypt when using AEAD_CHACHA20_POLY1305.const InvalidPacketLimitChaCha = 1 << 36
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |