logging

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package logging defines a logging interface for quic-go. This package should not be considered stable

Index

Constants

View Source
const (
	// ECNUnsupported means that no ECN value was set / received
	ECNUnsupported = protocol.ECNUnsupported
	// ECTNot is Not-ECT
	ECTNot = protocol.ECNNon
	// ECT0 is ECT(0)
	ECT0 = protocol.ECT0
	// ECT1 is ECT(1)
	ECT1 = protocol.ECT1
	// ECNCE is CE
	ECNCE = protocol.ECNCE
)
View Source
const (
	// StreamTypeUni is a unidirectional stream
	StreamTypeUni = protocol.StreamTypeUni
	// StreamTypeBidi is a bidirectional stream
	StreamTypeBidi = protocol.StreamTypeBidi
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AckFrame

type AckFrame = wire.AckFrame

An AckFrame is an ACK frame.

type AckRange

type AckRange = wire.AckRange

The AckRange is used within the AckFrame. It is a range of packet numbers that is being acknowledged.

type ApplicationError

type ApplicationError = qerr.TransportErrorCode

An ApplicationError is an application-defined error code.

type ArbitraryLenConnectionID

type ArbitraryLenConnectionID = protocol.ArbitraryLenConnectionID

An ArbitraryLenConnectionID is a QUIC Connection ID that can be up to 255 bytes long.

type ByteCount

type ByteCount = protocol.ByteCount

A ByteCount is used to count bytes.

type CongestionState

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
	// CongestionStateRecovery is the recovery phase of Reno / Cubic
	CongestionStateRecovery
	// CongestionStateApplicationLimited means that the congestion controller is application limited
	CongestionStateApplicationLimited
)

type ConnectionCloseFrame

type ConnectionCloseFrame = wire.ConnectionCloseFrame

A ConnectionCloseFrame is a CONNECTION_CLOSE frame.

type ConnectionID

type ConnectionID = protocol.ConnectionID

A ConnectionID is a QUIC Connection ID.

type ConnectionTracer

type ConnectionTracer struct {
	StartedConnection                func(local, remote net.Addr, srcConnID, destConnID ConnectionID)
	NegotiatedVersion                func(chosen VersionNumber, clientVersions, serverVersions []VersionNumber)
	ClosedConnection                 func(error)
	SentTransportParameters          func(*TransportParameters)
	ReceivedTransportParameters      func(*TransportParameters)
	RestoredTransportParameters      func(parameters *TransportParameters) // for 0-RTT
	SentLongHeaderPacket             func(*ExtendedHeader, ByteCount, ECN, *AckFrame, []Frame)
	SentShortHeaderPacket            func(*ShortHeader, ByteCount, ECN, *AckFrame, []Frame)
	ReceivedVersionNegotiationPacket func(dest, src ArbitraryLenConnectionID, _ []VersionNumber)
	ReceivedRetry                    func(*Header)
	ReceivedLongHeaderPacket         func(*ExtendedHeader, ByteCount, ECN, []Frame)
	ReceivedShortHeaderPacket        func(*ShortHeader, ByteCount, ECN, []Frame)
	BufferedPacket                   func(PacketType, ByteCount)
	DroppedPacket                    func(PacketType, PacketNumber, ByteCount, PacketDropReason)
	UpdatedMetrics                   func(rttStats *RTTStats, cwnd, bytesInFlight ByteCount, packetsInFlight int)
	AcknowledgedPacket               func(EncryptionLevel, PacketNumber)
	LostPacket                       func(EncryptionLevel, PacketNumber, PacketLossReason)
	UpdatedCongestionState           func(CongestionState)
	UpdatedPTOCount                  func(value uint32)
	UpdatedKeyFromTLS                func(EncryptionLevel, Perspective)
	UpdatedKey                       func(keyPhase KeyPhase, remote bool)
	DroppedEncryptionLevel           func(EncryptionLevel)
	DroppedKey                       func(keyPhase KeyPhase)
	SetLossTimer                     func(TimerType, EncryptionLevel, time.Time)
	LossTimerExpired                 func(TimerType, EncryptionLevel)
	LossTimerCanceled                func()
	ECNStateUpdated                  func(state ECNState, trigger ECNStateTrigger)
	ChoseALPN                        func(protocol string)
	// Close is called when the connection is closed.
	Close func()
	Debug func(name, msg string)
}

A ConnectionTracer records events.

func NewMultiplexedConnectionTracer

func NewMultiplexedConnectionTracer(tracers ...*ConnectionTracer) *ConnectionTracer

NewMultiplexedConnectionTracer creates a new connection tracer that multiplexes events to multiple tracers.

type CryptoFrame

type CryptoFrame struct {
	Offset ByteCount
	Length ByteCount
}

A CryptoFrame is a CRYPTO frame.

type DataBlockedFrame

type DataBlockedFrame = wire.DataBlockedFrame

A DataBlockedFrame is a DATA_BLOCKED frame.

type DatagramFrame

type DatagramFrame struct {
	Length ByteCount
}

A DatagramFrame is a DATAGRAM frame.

type ECN

type ECN = protocol.ECN

ECN is the ECN value

type ECNState

type ECNState uint8

ECNState is the state of the ECN state machine (see Appendix A.4 of RFC 9000)

const (
	// ECNStateTesting is the testing state
	ECNStateTesting ECNState = 1 + iota
	// ECNStateUnknown is the unknown state
	ECNStateUnknown
	// ECNStateFailed is the failed state
	ECNStateFailed
	// ECNStateCapable is the capable state
	ECNStateCapable
)

type ECNStateTrigger

type ECNStateTrigger uint8

ECNStateTrigger is a trigger for an ECN state transition.

const (
	ECNTriggerNoTrigger ECNStateTrigger = iota
	// ECNFailedNoECNCounts is emitted when an ACK acknowledges ECN-marked packets,
	// but doesn't contain any ECN counts
	ECNFailedNoECNCounts
	// ECNFailedDecreasedECNCounts is emitted when an ACK frame decreases ECN counts
	ECNFailedDecreasedECNCounts
	// ECNFailedLostAllTestingPackets is emitted when all ECN testing packets are declared lost
	ECNFailedLostAllTestingPackets
	// ECNFailedMoreECNCountsThanSent is emitted when an ACK contains more ECN counts than ECN-marked packets were sent
	ECNFailedMoreECNCountsThanSent
	// ECNFailedTooFewECNCounts is emitted when an ACK contains fewer ECN counts than it acknowledges packets
	ECNFailedTooFewECNCounts
	// ECNFailedManglingDetected is emitted when the path marks all ECN-marked packets as CE
	ECNFailedManglingDetected
)

type EncryptionLevel

type EncryptionLevel = protocol.EncryptionLevel

The EncryptionLevel is the encryption level of a packet.

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
)

type ExtendedHeader

type ExtendedHeader = wire.ExtendedHeader

The ExtendedHeader is the QUIC Long Header packet header, after removing header protection.

type Frame

type Frame interface{}

A Frame is a QUIC frame

type HandshakeDoneFrame

type HandshakeDoneFrame = wire.HandshakeDoneFrame

A HandshakeDoneFrame is a HANDSHAKE_DONE frame.

type Header = wire.Header

The Header is the QUIC packet header, before removing header protection.

type KeyPhase

type KeyPhase = protocol.KeyPhase

The KeyPhase is the key phase of the 1-RTT keys.

type KeyPhaseBit

type KeyPhaseBit = protocol.KeyPhaseBit

The KeyPhaseBit is the value of the key phase bit of the 1-RTT packets.

const (
	// KeyPhaseZero is key phase bit 0
	KeyPhaseZero KeyPhaseBit = protocol.KeyPhaseZero
	// KeyPhaseOne is key phase bit 1
	KeyPhaseOne KeyPhaseBit = protocol.KeyPhaseOne
)

type MaxDataFrame

type MaxDataFrame = wire.MaxDataFrame

A MaxDataFrame is a MAX_DATA frame.

type MaxStreamDataFrame

type MaxStreamDataFrame = wire.MaxStreamDataFrame

A MaxStreamDataFrame is a MAX_STREAM_DATA frame.

type MaxStreamsFrame

type MaxStreamsFrame = wire.MaxStreamsFrame

A MaxStreamsFrame is a MAX_STREAMS_FRAME.

type NewConnectionIDFrame

type NewConnectionIDFrame = wire.NewConnectionIDFrame

A NewConnectionIDFrame is a NEW_CONNECTION_ID frame.

type NewTokenFrame

type NewTokenFrame = wire.NewTokenFrame

A NewTokenFrame is a NEW_TOKEN frame.

type PacketDropReason

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
)

type PacketLossReason

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 PacketNumber

type PacketNumber = protocol.PacketNumber

The PacketNumber is the packet number of a packet.

type PacketType

type PacketType uint8

PacketType is the packet type of a QUIC packet

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
)

func PacketTypeFromHeader

func PacketTypeFromHeader(hdr *Header) PacketType

PacketTypeFromHeader determines the packet type from a *wire.Header.

type PathChallengeFrame

type PathChallengeFrame = wire.PathChallengeFrame

A PathChallengeFrame is a PATH_CHALLENGE frame.

type PathResponseFrame

type PathResponseFrame = wire.PathResponseFrame

A PathResponseFrame is a PATH_RESPONSE frame.

type Perspective

type Perspective = protocol.Perspective

The Perspective is the role of a QUIC endpoint (client or server).

const (
	// PerspectiveServer is used for a QUIC server
	PerspectiveServer Perspective = protocol.PerspectiveServer
	// PerspectiveClient is used for a QUIC client
	PerspectiveClient Perspective = protocol.PerspectiveClient
)

type PingFrame

type PingFrame = wire.PingFrame

A PingFrame is a PING frame.

type PreferredAddress

type PreferredAddress = wire.PreferredAddress

The PreferredAddress is the preferred address sent in the transport parameters.

type RTTStats

type RTTStats = utils.RTTStats

The RTTStats contain statistics used by the congestion controller.

type ResetStreamFrame

type ResetStreamFrame = wire.ResetStreamFrame

A ResetStreamFrame is a RESET_STREAM frame.

type RetireConnectionIDFrame

type RetireConnectionIDFrame = wire.RetireConnectionIDFrame

A RetireConnectionIDFrame is a RETIRE_CONNECTION_ID frame.

type ShortHeader

type ShortHeader struct {
	DestConnectionID ConnectionID
	PacketNumber     PacketNumber
	PacketNumberLen  protocol.PacketNumberLen
	KeyPhase         KeyPhaseBit
}

The ShortHeader is the QUIC Short Header packet header, after removing header protection.

type StatelessResetToken

type StatelessResetToken = protocol.StatelessResetToken

A StatelessResetToken is a stateless reset token.

type StopSendingFrame

type StopSendingFrame = wire.StopSendingFrame

A StopSendingFrame is a STOP_SENDING frame.

type StreamDataBlockedFrame

type StreamDataBlockedFrame = wire.StreamDataBlockedFrame

A StreamDataBlockedFrame is a STREAM_DATA_BLOCKED frame.

type StreamFrame

type StreamFrame struct {
	StreamID StreamID
	Offset   ByteCount
	Length   ByteCount
	Fin      bool
}

A StreamFrame is a STREAM frame.

type StreamID

type StreamID = protocol.StreamID

The StreamID is the stream ID.

type StreamNum

type StreamNum = protocol.StreamNum

The StreamNum is the number of the stream.

type StreamType

type StreamType = protocol.StreamType

The StreamType is the type of the stream (unidirectional or bidirectional).

type StreamsBlockedFrame

type StreamsBlockedFrame = wire.StreamsBlockedFrame

A StreamsBlockedFrame is a STREAMS_BLOCKED frame.

type TimeoutReason

type TimeoutReason uint8

TimeoutReason is the reason why a connection is closed

const (
	// TimeoutReasonHandshake is used when the connection 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 connection is closed due to an idle timeout
	// This reason is not defined in the qlog draft, but very useful for debugging.
	TimeoutReasonIdle
)

type TimerType

type TimerType uint8

TimerType is the type of the loss detection timer

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
)

type Tracer

type Tracer struct {
	SentPacket                   func(net.Addr, *Header, ByteCount, []Frame)
	SentVersionNegotiationPacket func(_ net.Addr, dest, src ArbitraryLenConnectionID, _ []VersionNumber)
	DroppedPacket                func(net.Addr, PacketType, ByteCount, PacketDropReason)
	Debug                        func(name, msg string)
	Close                        func()
}

A Tracer traces events.

func NewMultiplexedTracer

func NewMultiplexedTracer(tracers ...*Tracer) *Tracer

NewMultiplexedTracer creates a new tracer that multiplexes events to multiple tracers.

type TransportError

type TransportError = qerr.TransportErrorCode

A TransportError is a transport-level error code.

type TransportParameters

type TransportParameters = wire.TransportParameters

The TransportParameters are QUIC transport parameters.

type VersionNumber

type VersionNumber = protocol.Version

The VersionNumber is the QUIC version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL