mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-28 05:59:58 +00:00
TUN-4597: Add a QUIC server skeleton
- Added a QUIC server to accept streams - Unit test for this server also tests ALPN - Temporary echo capability for HTTP ConnectionType
This commit is contained in:
66
vendor/github.com/lucas-clemente/quic-go/logging/frame.go
generated
vendored
Normal file
66
vendor/github.com/lucas-clemente/quic-go/logging/frame.go
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
package logging
|
||||
|
||||
import "github.com/lucas-clemente/quic-go/internal/wire"
|
||||
|
||||
// A Frame is a QUIC frame
|
||||
type Frame interface{}
|
||||
|
||||
// The AckRange is used within the AckFrame.
|
||||
// It is a range of packet numbers that is being acknowledged.
|
||||
type AckRange = wire.AckRange
|
||||
|
||||
type (
|
||||
// An AckFrame is an ACK frame.
|
||||
AckFrame = wire.AckFrame
|
||||
// A ConnectionCloseFrame is a CONNECTION_CLOSE frame.
|
||||
ConnectionCloseFrame = wire.ConnectionCloseFrame
|
||||
// A DataBlockedFrame is a DATA_BLOCKED frame.
|
||||
DataBlockedFrame = wire.DataBlockedFrame
|
||||
// A HandshakeDoneFrame is a HANDSHAKE_DONE frame.
|
||||
HandshakeDoneFrame = wire.HandshakeDoneFrame
|
||||
// A MaxDataFrame is a MAX_DATA frame.
|
||||
MaxDataFrame = wire.MaxDataFrame
|
||||
// A MaxStreamDataFrame is a MAX_STREAM_DATA frame.
|
||||
MaxStreamDataFrame = wire.MaxStreamDataFrame
|
||||
// A MaxStreamsFrame is a MAX_STREAMS_FRAME.
|
||||
MaxStreamsFrame = wire.MaxStreamsFrame
|
||||
// A NewConnectionIDFrame is a NEW_CONNECTION_ID frame.
|
||||
NewConnectionIDFrame = wire.NewConnectionIDFrame
|
||||
// A NewTokenFrame is a NEW_TOKEN frame.
|
||||
NewTokenFrame = wire.NewTokenFrame
|
||||
// A PathChallengeFrame is a PATH_CHALLENGE frame.
|
||||
PathChallengeFrame = wire.PathChallengeFrame
|
||||
// A PathResponseFrame is a PATH_RESPONSE frame.
|
||||
PathResponseFrame = wire.PathResponseFrame
|
||||
// A PingFrame is a PING frame.
|
||||
PingFrame = wire.PingFrame
|
||||
// A ResetStreamFrame is a RESET_STREAM frame.
|
||||
ResetStreamFrame = wire.ResetStreamFrame
|
||||
// A RetireConnectionIDFrame is a RETIRE_CONNECTION_ID frame.
|
||||
RetireConnectionIDFrame = wire.RetireConnectionIDFrame
|
||||
// A StopSendingFrame is a STOP_SENDING frame.
|
||||
StopSendingFrame = wire.StopSendingFrame
|
||||
// A StreamsBlockedFrame is a STREAMS_BLOCKED frame.
|
||||
StreamsBlockedFrame = wire.StreamsBlockedFrame
|
||||
// A StreamDataBlockedFrame is a STREAM_DATA_BLOCKED frame.
|
||||
StreamDataBlockedFrame = wire.StreamDataBlockedFrame
|
||||
)
|
||||
|
||||
// A CryptoFrame is a CRYPTO frame.
|
||||
type CryptoFrame struct {
|
||||
Offset ByteCount
|
||||
Length ByteCount
|
||||
}
|
||||
|
||||
// A StreamFrame is a STREAM frame.
|
||||
type StreamFrame struct {
|
||||
StreamID StreamID
|
||||
Offset ByteCount
|
||||
Length ByteCount
|
||||
Fin bool
|
||||
}
|
||||
|
||||
// A DatagramFrame is a DATAGRAM frame.
|
||||
type DatagramFrame struct {
|
||||
Length ByteCount
|
||||
}
|
134
vendor/github.com/lucas-clemente/quic-go/logging/interface.go
generated
vendored
Normal file
134
vendor/github.com/lucas-clemente/quic-go/logging/interface.go
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
// Package logging defines a logging interface for quic-go.
|
||||
// This package should not be considered stable
|
||||
package logging
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/qerr"
|
||||
"github.com/lucas-clemente/quic-go/internal/wire"
|
||||
)
|
||||
|
||||
type (
|
||||
// A ByteCount is used to count bytes.
|
||||
ByteCount = protocol.ByteCount
|
||||
// A ConnectionID is a QUIC Connection ID.
|
||||
ConnectionID = protocol.ConnectionID
|
||||
// The EncryptionLevel is the encryption level of a packet.
|
||||
EncryptionLevel = protocol.EncryptionLevel
|
||||
// The KeyPhase is the key phase of the 1-RTT keys.
|
||||
KeyPhase = protocol.KeyPhase
|
||||
// The KeyPhaseBit is the value of the key phase bit of the 1-RTT packets.
|
||||
KeyPhaseBit = protocol.KeyPhaseBit
|
||||
// The PacketNumber is the packet number of a packet.
|
||||
PacketNumber = protocol.PacketNumber
|
||||
// The Perspective is the role of a QUIC endpoint (client or server).
|
||||
Perspective = protocol.Perspective
|
||||
// A StatelessResetToken is a stateless reset token.
|
||||
StatelessResetToken = protocol.StatelessResetToken
|
||||
// The StreamID is the stream ID.
|
||||
StreamID = protocol.StreamID
|
||||
// The StreamNum is the number of the stream.
|
||||
StreamNum = protocol.StreamNum
|
||||
// The StreamType is the type of the stream (unidirectional or bidirectional).
|
||||
StreamType = protocol.StreamType
|
||||
// The VersionNumber is the QUIC version.
|
||||
VersionNumber = protocol.VersionNumber
|
||||
|
||||
// The Header is the QUIC packet header, before removing header protection.
|
||||
Header = wire.Header
|
||||
// The ExtendedHeader is the QUIC packet header, after removing header protection.
|
||||
ExtendedHeader = wire.ExtendedHeader
|
||||
// The TransportParameters are QUIC transport parameters.
|
||||
TransportParameters = wire.TransportParameters
|
||||
// The PreferredAddress is the preferred address sent in the transport parameters.
|
||||
PreferredAddress = wire.PreferredAddress
|
||||
|
||||
// A TransportError is a transport-level error code.
|
||||
TransportError = qerr.TransportErrorCode
|
||||
// An ApplicationError is an application-defined error code.
|
||||
ApplicationError = qerr.TransportErrorCode
|
||||
|
||||
// The RTTStats contain statistics used by the congestion controller.
|
||||
RTTStats = utils.RTTStats
|
||||
)
|
||||
|
||||
const (
|
||||
// KeyPhaseZero is key phase bit 0
|
||||
KeyPhaseZero KeyPhaseBit = protocol.KeyPhaseZero
|
||||
// KeyPhaseOne is key phase bit 1
|
||||
KeyPhaseOne KeyPhaseBit = protocol.KeyPhaseOne
|
||||
)
|
||||
|
||||
const (
|
||||
// PerspectiveServer is used for a QUIC server
|
||||
PerspectiveServer Perspective = protocol.PerspectiveServer
|
||||
// PerspectiveClient is used for a QUIC client
|
||||
PerspectiveClient Perspective = protocol.PerspectiveClient
|
||||
)
|
||||
|
||||
const (
|
||||
// EncryptionInitial is the Initial encryption level
|
||||
EncryptionInitial EncryptionLevel = protocol.EncryptionInitial
|
||||
// EncryptionHandshake is the Handshake encryption level
|
||||
EncryptionHandshake EncryptionLevel = protocol.EncryptionHandshake
|
||||
// Encryption1RTT is the 1-RTT encryption level
|
||||
Encryption1RTT EncryptionLevel = protocol.Encryption1RTT
|
||||
// Encryption0RTT is the 0-RTT encryption level
|
||||
Encryption0RTT EncryptionLevel = protocol.Encryption0RTT
|
||||
)
|
||||
|
||||
const (
|
||||
// StreamTypeUni is a unidirectional stream
|
||||
StreamTypeUni = protocol.StreamTypeUni
|
||||
// StreamTypeBidi is a bidirectional stream
|
||||
StreamTypeBidi = protocol.StreamTypeBidi
|
||||
)
|
||||
|
||||
// A Tracer traces events.
|
||||
type Tracer interface {
|
||||
// TracerForConnection requests a new tracer for a connection.
|
||||
// The ODCID is the original destination connection ID:
|
||||
// The destination connection ID that the client used on the first Initial packet it sent on this connection.
|
||||
// If nil is returned, tracing will be disabled for this connection.
|
||||
TracerForConnection(ctx context.Context, p Perspective, odcid ConnectionID) ConnectionTracer
|
||||
|
||||
SentPacket(net.Addr, *Header, ByteCount, []Frame)
|
||||
DroppedPacket(net.Addr, PacketType, ByteCount, PacketDropReason)
|
||||
}
|
||||
|
||||
// A ConnectionTracer records events.
|
||||
type ConnectionTracer interface {
|
||||
StartedConnection(local, remote net.Addr, srcConnID, destConnID ConnectionID)
|
||||
NegotiatedVersion(chosen VersionNumber, clientVersions, serverVersions []VersionNumber)
|
||||
ClosedConnection(error)
|
||||
SentTransportParameters(*TransportParameters)
|
||||
ReceivedTransportParameters(*TransportParameters)
|
||||
RestoredTransportParameters(parameters *TransportParameters) // for 0-RTT
|
||||
SentPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame)
|
||||
ReceivedVersionNegotiationPacket(*Header, []VersionNumber)
|
||||
ReceivedRetry(*Header)
|
||||
ReceivedPacket(hdr *ExtendedHeader, size ByteCount, frames []Frame)
|
||||
BufferedPacket(PacketType)
|
||||
DroppedPacket(PacketType, ByteCount, PacketDropReason)
|
||||
UpdatedMetrics(rttStats *RTTStats, cwnd, bytesInFlight ByteCount, packetsInFlight int)
|
||||
AcknowledgedPacket(EncryptionLevel, PacketNumber)
|
||||
LostPacket(EncryptionLevel, PacketNumber, PacketLossReason)
|
||||
UpdatedCongestionState(CongestionState)
|
||||
UpdatedPTOCount(value uint32)
|
||||
UpdatedKeyFromTLS(EncryptionLevel, Perspective)
|
||||
UpdatedKey(generation KeyPhase, remote bool)
|
||||
DroppedEncryptionLevel(EncryptionLevel)
|
||||
DroppedKey(generation KeyPhase)
|
||||
SetLossTimer(TimerType, EncryptionLevel, time.Time)
|
||||
LossTimerExpired(TimerType, EncryptionLevel)
|
||||
LossTimerCanceled()
|
||||
// Close is called when the connection is closed.
|
||||
Close()
|
||||
Debug(name, msg string)
|
||||
}
|
4
vendor/github.com/lucas-clemente/quic-go/logging/mockgen.go
generated
vendored
Normal file
4
vendor/github.com/lucas-clemente/quic-go/logging/mockgen.go
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
package logging
|
||||
|
||||
//go:generate sh -c "mockgen -package logging -self_package github.com/lucas-clemente/quic-go/logging -destination mock_connection_tracer_test.go github.com/lucas-clemente/quic-go/logging ConnectionTracer && goimports -w mock_connection_tracer_test.go"
|
||||
//go:generate sh -c "mockgen -package logging -self_package github.com/lucas-clemente/quic-go/logging -destination mock_tracer_test.go github.com/lucas-clemente/quic-go/logging Tracer && goimports -w mock_tracer_test.go"
|
219
vendor/github.com/lucas-clemente/quic-go/logging/multiplex.go
generated
vendored
Normal file
219
vendor/github.com/lucas-clemente/quic-go/logging/multiplex.go
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type tracerMultiplexer struct {
|
||||
tracers []Tracer
|
||||
}
|
||||
|
||||
var _ Tracer = &tracerMultiplexer{}
|
||||
|
||||
// NewMultiplexedTracer creates a new tracer that multiplexes events to multiple tracers.
|
||||
func NewMultiplexedTracer(tracers ...Tracer) Tracer {
|
||||
if len(tracers) == 0 {
|
||||
return nil
|
||||
}
|
||||
if len(tracers) == 1 {
|
||||
return tracers[0]
|
||||
}
|
||||
return &tracerMultiplexer{tracers}
|
||||
}
|
||||
|
||||
func (m *tracerMultiplexer) TracerForConnection(ctx context.Context, p Perspective, odcid ConnectionID) ConnectionTracer {
|
||||
var connTracers []ConnectionTracer
|
||||
for _, t := range m.tracers {
|
||||
if ct := t.TracerForConnection(ctx, p, odcid); ct != nil {
|
||||
connTracers = append(connTracers, ct)
|
||||
}
|
||||
}
|
||||
return NewMultiplexedConnectionTracer(connTracers...)
|
||||
}
|
||||
|
||||
func (m *tracerMultiplexer) SentPacket(remote net.Addr, hdr *Header, size ByteCount, frames []Frame) {
|
||||
for _, t := range m.tracers {
|
||||
t.SentPacket(remote, hdr, size, frames)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *tracerMultiplexer) DroppedPacket(remote net.Addr, typ PacketType, size ByteCount, reason PacketDropReason) {
|
||||
for _, t := range m.tracers {
|
||||
t.DroppedPacket(remote, typ, size, reason)
|
||||
}
|
||||
}
|
||||
|
||||
type connTracerMultiplexer struct {
|
||||
tracers []ConnectionTracer
|
||||
}
|
||||
|
||||
var _ ConnectionTracer = &connTracerMultiplexer{}
|
||||
|
||||
// NewMultiplexedConnectionTracer creates a new connection tracer that multiplexes events to multiple tracers.
|
||||
func NewMultiplexedConnectionTracer(tracers ...ConnectionTracer) ConnectionTracer {
|
||||
if len(tracers) == 0 {
|
||||
return nil
|
||||
}
|
||||
if len(tracers) == 1 {
|
||||
return tracers[0]
|
||||
}
|
||||
return &connTracerMultiplexer{tracers: tracers}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) StartedConnection(local, remote net.Addr, srcConnID, destConnID ConnectionID) {
|
||||
for _, t := range m.tracers {
|
||||
t.StartedConnection(local, remote, srcConnID, destConnID)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) NegotiatedVersion(chosen VersionNumber, clientVersions, serverVersions []VersionNumber) {
|
||||
for _, t := range m.tracers {
|
||||
t.NegotiatedVersion(chosen, clientVersions, serverVersions)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) ClosedConnection(e error) {
|
||||
for _, t := range m.tracers {
|
||||
t.ClosedConnection(e)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) SentTransportParameters(tp *TransportParameters) {
|
||||
for _, t := range m.tracers {
|
||||
t.SentTransportParameters(tp)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) ReceivedTransportParameters(tp *TransportParameters) {
|
||||
for _, t := range m.tracers {
|
||||
t.ReceivedTransportParameters(tp)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) RestoredTransportParameters(tp *TransportParameters) {
|
||||
for _, t := range m.tracers {
|
||||
t.RestoredTransportParameters(tp)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) SentPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame) {
|
||||
for _, t := range m.tracers {
|
||||
t.SentPacket(hdr, size, ack, frames)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) ReceivedVersionNegotiationPacket(hdr *Header, versions []VersionNumber) {
|
||||
for _, t := range m.tracers {
|
||||
t.ReceivedVersionNegotiationPacket(hdr, versions)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) ReceivedRetry(hdr *Header) {
|
||||
for _, t := range m.tracers {
|
||||
t.ReceivedRetry(hdr)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) ReceivedPacket(hdr *ExtendedHeader, size ByteCount, frames []Frame) {
|
||||
for _, t := range m.tracers {
|
||||
t.ReceivedPacket(hdr, size, frames)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) BufferedPacket(typ PacketType) {
|
||||
for _, t := range m.tracers {
|
||||
t.BufferedPacket(typ)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) DroppedPacket(typ PacketType, size ByteCount, reason PacketDropReason) {
|
||||
for _, t := range m.tracers {
|
||||
t.DroppedPacket(typ, size, reason)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) UpdatedCongestionState(state CongestionState) {
|
||||
for _, t := range m.tracers {
|
||||
t.UpdatedCongestionState(state)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) UpdatedMetrics(rttStats *RTTStats, cwnd, bytesInFLight ByteCount, packetsInFlight int) {
|
||||
for _, t := range m.tracers {
|
||||
t.UpdatedMetrics(rttStats, cwnd, bytesInFLight, packetsInFlight)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) AcknowledgedPacket(encLevel EncryptionLevel, pn PacketNumber) {
|
||||
for _, t := range m.tracers {
|
||||
t.AcknowledgedPacket(encLevel, pn)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) LostPacket(encLevel EncryptionLevel, pn PacketNumber, reason PacketLossReason) {
|
||||
for _, t := range m.tracers {
|
||||
t.LostPacket(encLevel, pn, reason)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) UpdatedPTOCount(value uint32) {
|
||||
for _, t := range m.tracers {
|
||||
t.UpdatedPTOCount(value)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) UpdatedKeyFromTLS(encLevel EncryptionLevel, perspective Perspective) {
|
||||
for _, t := range m.tracers {
|
||||
t.UpdatedKeyFromTLS(encLevel, perspective)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) UpdatedKey(generation KeyPhase, remote bool) {
|
||||
for _, t := range m.tracers {
|
||||
t.UpdatedKey(generation, remote)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) DroppedEncryptionLevel(encLevel EncryptionLevel) {
|
||||
for _, t := range m.tracers {
|
||||
t.DroppedEncryptionLevel(encLevel)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) DroppedKey(generation KeyPhase) {
|
||||
for _, t := range m.tracers {
|
||||
t.DroppedKey(generation)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) SetLossTimer(typ TimerType, encLevel EncryptionLevel, exp time.Time) {
|
||||
for _, t := range m.tracers {
|
||||
t.SetLossTimer(typ, encLevel, exp)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) LossTimerExpired(typ TimerType, encLevel EncryptionLevel) {
|
||||
for _, t := range m.tracers {
|
||||
t.LossTimerExpired(typ, encLevel)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) LossTimerCanceled() {
|
||||
for _, t := range m.tracers {
|
||||
t.LossTimerCanceled()
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) Debug(name, msg string) {
|
||||
for _, t := range m.tracers {
|
||||
t.Debug(name, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) Close() {
|
||||
for _, t := range m.tracers {
|
||||
t.Close()
|
||||
}
|
||||
}
|
27
vendor/github.com/lucas-clemente/quic-go/logging/packet_header.go
generated
vendored
Normal file
27
vendor/github.com/lucas-clemente/quic-go/logging/packet_header.go
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
)
|
||||
|
||||
// PacketTypeFromHeader determines the packet type from a *wire.Header.
|
||||
func PacketTypeFromHeader(hdr *Header) PacketType {
|
||||
if !hdr.IsLongHeader {
|
||||
return PacketType1RTT
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
94
vendor/github.com/lucas-clemente/quic-go/logging/types.go
generated
vendored
Normal file
94
vendor/github.com/lucas-clemente/quic-go/logging/types.go
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
package logging
|
||||
|
||||
// PacketType is the packet type of a QUIC packet
|
||||
type PacketType uint8
|
||||
|
||||
const (
|
||||
// PacketTypeInitial is the packet type of an Initial packet
|
||||
PacketTypeInitial PacketType = iota
|
||||
// PacketTypeHandshake is the packet type of a Handshake packet
|
||||
PacketTypeHandshake
|
||||
// PacketTypeRetry is the packet type of a Retry packet
|
||||
PacketTypeRetry
|
||||
// PacketType0RTT is the packet type of a 0-RTT packet
|
||||
PacketType0RTT
|
||||
// PacketTypeVersionNegotiation is the packet type of a Version Negotiation packet
|
||||
PacketTypeVersionNegotiation
|
||||
// PacketType1RTT is a 1-RTT packet
|
||||
PacketType1RTT
|
||||
// PacketTypeStatelessReset is a stateless reset
|
||||
PacketTypeStatelessReset
|
||||
// PacketTypeNotDetermined is the packet type when it could not be determined
|
||||
PacketTypeNotDetermined
|
||||
)
|
||||
|
||||
type PacketLossReason uint8
|
||||
|
||||
const (
|
||||
// PacketLossReorderingThreshold: when a packet is deemed lost due to reordering threshold
|
||||
PacketLossReorderingThreshold PacketLossReason = iota
|
||||
// PacketLossTimeThreshold: when a packet is deemed lost due to time threshold
|
||||
PacketLossTimeThreshold
|
||||
)
|
||||
|
||||
type PacketDropReason uint8
|
||||
|
||||
const (
|
||||
// PacketDropKeyUnavailable is used when a packet is dropped because keys are unavailable
|
||||
PacketDropKeyUnavailable PacketDropReason = iota
|
||||
// PacketDropUnknownConnectionID is used when a packet is dropped because the connection ID is unknown
|
||||
PacketDropUnknownConnectionID
|
||||
// PacketDropHeaderParseError is used when a packet is dropped because header parsing failed
|
||||
PacketDropHeaderParseError
|
||||
// PacketDropPayloadDecryptError is used when a packet is dropped because decrypting the payload failed
|
||||
PacketDropPayloadDecryptError
|
||||
// PacketDropProtocolViolation is used when a packet is dropped due to a protocol violation
|
||||
PacketDropProtocolViolation
|
||||
// PacketDropDOSPrevention is used when a packet is dropped to mitigate a DoS attack
|
||||
PacketDropDOSPrevention
|
||||
// PacketDropUnsupportedVersion is used when a packet is dropped because the version is not supported
|
||||
PacketDropUnsupportedVersion
|
||||
// PacketDropUnexpectedPacket is used when an unexpected packet is received
|
||||
PacketDropUnexpectedPacket
|
||||
// PacketDropUnexpectedSourceConnectionID is used when a packet with an unexpected source connection ID is received
|
||||
PacketDropUnexpectedSourceConnectionID
|
||||
// PacketDropUnexpectedVersion is used when a packet with an unexpected version is received
|
||||
PacketDropUnexpectedVersion
|
||||
// PacketDropDuplicate is used when a duplicate packet is received
|
||||
PacketDropDuplicate
|
||||
)
|
||||
|
||||
// TimerType is the type of the loss detection timer
|
||||
type TimerType uint8
|
||||
|
||||
const (
|
||||
// TimerTypeACK is the timer type for the early retransmit timer
|
||||
TimerTypeACK TimerType = iota
|
||||
// TimerTypePTO is the timer type for the PTO retransmit timer
|
||||
TimerTypePTO
|
||||
)
|
||||
|
||||
// TimeoutReason is the reason why a session is closed
|
||||
type TimeoutReason uint8
|
||||
|
||||
const (
|
||||
// TimeoutReasonHandshake is used when the session is closed due to a handshake timeout
|
||||
// This reason is not defined in the qlog draft, but very useful for debugging.
|
||||
TimeoutReasonHandshake TimeoutReason = iota
|
||||
// TimeoutReasonIdle is used when the session is closed due to an idle timeout
|
||||
// This reason is not defined in the qlog draft, but very useful for debugging.
|
||||
TimeoutReasonIdle
|
||||
)
|
||||
|
||||
type CongestionState uint8
|
||||
|
||||
const (
|
||||
// CongestionStateSlowStart is the slow start phase of Reno / Cubic
|
||||
CongestionStateSlowStart CongestionState = iota
|
||||
// CongestionStateCongestionAvoidance is the slow start phase of Reno / Cubic
|
||||
CongestionStateCongestionAvoidance
|
||||
// CongestionStateCongestionAvoidance is the recovery phase of Reno / Cubic
|
||||
CongestionStateRecovery
|
||||
// CongestionStateApplicationLimited means that the congestion controller is application limited
|
||||
CongestionStateApplicationLimited
|
||||
)
|
Reference in New Issue
Block a user