qlog

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyPhaseZero is key phase bit 0
	KeyPhaseZero = protocol.KeyPhaseZero
	// KeyPhaseOne is key phase bit 1
	KeyPhaseOne = protocol.KeyPhaseOne
)
View Source
const EventSchema = "urn:ietf:params:qlog:events:quic-12"

EventSchema is the qlog event schema for QUIC

Variables

This section is empty.

Functions

func DefaultConnectionTracer

func DefaultConnectionTracer(_ context.Context, isClient bool, connID ConnectionID) qlogwriter.Trace

DefaultConnectionTracer creates a qlog file in the qlog directory specified by the QLOGDIR environment variable. File names are <odcid>_<perspective>.sqlog. Returns nil if QLOGDIR is not set.

func DefaultConnectionTracerWithSchemas

func DefaultConnectionTracerWithSchemas(_ context.Context, isClient bool, connID ConnectionID, eventSchemas []string) qlogwriter.Trace

Types

type ALPNInformation

type ALPNInformation struct {
	ChosenALPN string
}

func (ALPNInformation) Encode

func (e ALPNInformation) Encode(enc *jsontext.Encoder, _ time.Time) error

func (ALPNInformation) Name

func (e ALPNInformation) Name() string

type AckFrame

type AckFrame = wire.AckFrame

An AckFrame is an ACK frame.

type AckFrequencyFrame

type AckFrequencyFrame = wire.AckFrequencyFrame

An AckFrequencyFrame is an ACK_FREQUENCY frame.

type AckRange

type AckRange = wire.AckRange

type ApplicationErrorCode

type ApplicationErrorCode = qerr.ApplicationErrorCode

type ArbitraryLenConnectionID

type ArbitraryLenConnectionID = protocol.ArbitraryLenConnectionID

type CongestionState

type CongestionState string
const (
	// CongestionStateSlowStart is the slow start phase of Reno / Cubic
	CongestionStateSlowStart CongestionState = "slow_start"
	// CongestionStateCongestionAvoidance is the congestion avoidance phase of Reno / Cubic
	CongestionStateCongestionAvoidance CongestionState = "congestion_avoidance"
	// CongestionStateRecovery is the recovery phase of Reno / Cubic
	CongestionStateRecovery CongestionState = "recovery"
	// CongestionStateApplicationLimited means that the congestion controller is application limited
	CongestionStateApplicationLimited CongestionState = "application_limited"
)

func (CongestionState) String

func (s CongestionState) String() string

type CongestionStateUpdated

type CongestionStateUpdated struct {
	State CongestionState
}

func (CongestionStateUpdated) Encode

func (CongestionStateUpdated) Name

func (e CongestionStateUpdated) Name() string

type ConnectionCloseFrame

type ConnectionCloseFrame = wire.ConnectionCloseFrame

A ConnectionCloseFrame is a CONNECTION_CLOSE frame.

type ConnectionCloseTrigger

type ConnectionCloseTrigger string
const (
	// IdleTimeout indicates the connection was closed due to idle timeout
	ConnectionCloseTriggerIdleTimeout ConnectionCloseTrigger = "idle_timeout"
	// Application indicates the connection was closed by the application
	ConnectionCloseTriggerApplication ConnectionCloseTrigger = "application"
	// VersionMismatch indicates the connection was closed due to a QUIC version mismatch
	ConnectionCloseTriggerVersionMismatch ConnectionCloseTrigger = "version_mismatch"
	// StatelessReset indicates the connection was closed due to receiving a stateless reset from the peer
	ConnectionCloseTriggerStatelessReset ConnectionCloseTrigger = "stateless_reset"
)

type ConnectionClosed

type ConnectionClosed struct {
	Initiator Initiator

	ConnectionError  *TransportErrorCode
	ApplicationError *ApplicationErrorCode

	Reason string

	Trigger ConnectionCloseTrigger
}

func (ConnectionClosed) Encode

func (e ConnectionClosed) Encode(enc *jsontext.Encoder, _ time.Time) error

func (ConnectionClosed) Name

func (e ConnectionClosed) Name() string

type ConnectionID

type ConnectionID = protocol.ConnectionID

type CryptoFrame

type CryptoFrame struct {
	Offset int64
	Length int64
}

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 int64
}

A DatagramFrame is a DATAGRAM frame.

type DatagramID

type DatagramID uint32

DatagramID is a unique identifier for a datagram

func CalculateDatagramID

func CalculateDatagramID(packet []byte) DatagramID

CalculateDatagramID computes a DatagramID for a given packet

type DebugEvent

type DebugEvent struct {
	EventName string
	Message   string
}

DebugEvent is a generic event that can be used to log arbitrary messages.

func (DebugEvent) Encode

func (e DebugEvent) Encode(enc *jsontext.Encoder, _ time.Time) error

func (DebugEvent) Name

func (e DebugEvent) Name() string

type ECN

type ECN string

ECN represents the Explicit Congestion Notification value.

const (
	// ECNUnsupported means that no ECN value was set / received
	ECNUnsupported ECN = ""
	// ECTNot is Not-ECT
	ECTNot ECN = "Not-ECT"
	// ECT0 is ECT(0)
	ECT0 ECN = "ECT(0)"
	// ECT1 is ECT(1)
	ECT1 ECN = "ECT(1)"
	// ECNCE is CE
	ECNCE ECN = "CE"
)

type ECNState

type ECNState string

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

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

type ECNStateUpdated

type ECNStateUpdated struct {
	State   ECNState
	Trigger string
}

func (ECNStateUpdated) Encode

func (e ECNStateUpdated) Encode(enc *jsontext.Encoder, _ time.Time) error

func (ECNStateUpdated) Name

func (e ECNStateUpdated) Name() string

type EncryptionLevel

type EncryptionLevel = protocol.EncryptionLevel

type Frame

type Frame struct {
	Frame any
}

func (Frame) Encode

func (f Frame) Encode(enc *jsontext.Encoder) error

type HandshakeDoneFrame

type HandshakeDoneFrame = wire.HandshakeDoneFrame

A HandshakeDoneFrame is a HANDSHAKE_DONE frame.

type ImmediateAckFrame

type ImmediateAckFrame = wire.ImmediateAckFrame

An ImmediateAckFrame is an IMMEDIATE_ACK frame.

type Initiator

type Initiator string
const (
	InitiatorLocal  Initiator = "local"
	InitiatorRemote Initiator = "remote"
)

type KeyDiscarded

type KeyDiscarded struct {
	KeyType  KeyType
	KeyPhase KeyPhase // only set for 1-RTT keys
}

func (KeyDiscarded) Encode

func (e KeyDiscarded) Encode(enc *jsontext.Encoder, _ time.Time) error

func (KeyDiscarded) Name

func (e KeyDiscarded) Name() string

type KeyPhase

type KeyPhase = protocol.KeyPhase

type KeyPhaseBit

type KeyPhaseBit = protocol.KeyPhaseBit

type KeyType

type KeyType string

KeyType represents the type of cryptographic key used in QUIC connections.

const (
	// KeyTypeServerInitial represents the server's initial secret key.
	KeyTypeServerInitial KeyType = "server_initial_secret"
	// KeyTypeClientInitial represents the client's initial secret key.
	KeyTypeClientInitial KeyType = "client_initial_secret"
	// KeyTypeServerHandshake represents the server's handshake secret key.
	KeyTypeServerHandshake KeyType = "server_handshake_secret"
	// KeyTypeClientHandshake represents the client's handshake secret key.
	KeyTypeClientHandshake KeyType = "client_handshake_secret"
	// KeyTypeServer0RTT represents the server's 0-RTT secret key.
	KeyTypeServer0RTT KeyType = "server_0rtt_secret"
	// KeyTypeClient0RTT represents the client's 0-RTT secret key.
	KeyTypeClient0RTT KeyType = "client_0rtt_secret"
	// KeyTypeServer1RTT represents the server's 1-RTT secret key.
	KeyTypeServer1RTT KeyType = "server_1rtt_secret"
	// KeyTypeClient1RTT represents the client's 1-RTT secret key.
	KeyTypeClient1RTT KeyType = "client_1rtt_secret"
)

type KeyUpdateTrigger

type KeyUpdateTrigger string

KeyUpdateTrigger describes what caused a key update event.

const (
	// KeyUpdateTLS indicates the key update was triggered by TLS.
	KeyUpdateTLS KeyUpdateTrigger = "tls"
	// KeyUpdateRemote indicates the key update was triggered by the remote peer.
	KeyUpdateRemote KeyUpdateTrigger = "remote_update"
	// KeyUpdateLocal indicates the key update was triggered locally.
	KeyUpdateLocal KeyUpdateTrigger = "local_update"
)

type KeyUpdated

type KeyUpdated struct {
	Trigger  KeyUpdateTrigger
	KeyType  KeyType
	KeyPhase KeyPhase // only set for 1-RTT keys

}

func (KeyUpdated) Encode

func (e KeyUpdated) Encode(enc *jsontext.Encoder, _ time.Time) error

func (KeyUpdated) Name

func (e KeyUpdated) Name() string

type LossTimerUpdateType

type LossTimerUpdateType string
const (
	LossTimerUpdateTypeSet       LossTimerUpdateType = "set"
	LossTimerUpdateTypeExpired   LossTimerUpdateType = "expired"
	LossTimerUpdateTypeCancelled LossTimerUpdateType = "cancelled"
)

type LossTimerUpdated

type LossTimerUpdated struct {
	Type      LossTimerUpdateType
	TimerType TimerType
	EncLevel  EncryptionLevel
	Time      time.Time
}

func (LossTimerUpdated) Encode

func (e LossTimerUpdated) Encode(enc *jsontext.Encoder, t time.Time) error

func (LossTimerUpdated) Name

func (e LossTimerUpdated) Name() string

type MTUUpdated

type MTUUpdated struct {
	Value int
	Done  bool
}

func (MTUUpdated) Encode

func (e MTUUpdated) Encode(enc *jsontext.Encoder, _ time.Time) error

func (MTUUpdated) Name

func (e MTUUpdated) Name() string

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 MetricsUpdated

type MetricsUpdated struct {
	MinRTT           time.Duration
	SmoothedRTT      time.Duration
	LatestRTT        time.Duration
	RTTVariance      time.Duration
	CongestionWindow int
	BytesInFlight    int
	PacketsInFlight  int
}

MetricsUpdated logs RTT and congestion metrics as defined in the recovery:metrics_updated event. The PTO count is logged via PTOCountUpdated.

func (MetricsUpdated) Encode

func (e MetricsUpdated) Encode(enc *jsontext.Encoder, _ time.Time) error

func (MetricsUpdated) Name

func (e MetricsUpdated) Name() string

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 PTOCountUpdated

type PTOCountUpdated struct {
	PTOCount uint32
}

PTOCountUpdated logs the pto_count value of the recovery:metrics_updated event.

func (PTOCountUpdated) Encode

func (e PTOCountUpdated) Encode(enc *jsontext.Encoder, _ time.Time) error

func (PTOCountUpdated) Name

func (e PTOCountUpdated) Name() string

type PacketBuffered

type PacketBuffered struct {
	Header     PacketHeader
	Raw        RawInfo
	DatagramID DatagramID
}

func (PacketBuffered) Encode

func (e PacketBuffered) Encode(enc *jsontext.Encoder, _ time.Time) error

func (PacketBuffered) Name

func (e PacketBuffered) Name() string

type PacketDropReason

type PacketDropReason string
const (
	// PacketDropKeyUnavailable is used when a packet is dropped because keys are unavailable
	PacketDropKeyUnavailable PacketDropReason = "key_unavailable"
	// PacketDropUnknownConnectionID is used when a packet is dropped because the connection ID is unknown
	PacketDropUnknownConnectionID PacketDropReason = "unknown_connection_id"
	// PacketDropHeaderParseError is used when a packet is dropped because header parsing failed
	PacketDropHeaderParseError PacketDropReason = "header_parse_error"
	// PacketDropPayloadDecryptError is used when a packet is dropped because decrypting the payload failed
	PacketDropPayloadDecryptError PacketDropReason = "payload_decrypt_error"
	// PacketDropProtocolViolation is used when a packet is dropped due to a protocol violation
	PacketDropProtocolViolation PacketDropReason = "protocol_violation"
	// PacketDropDOSPrevention is used when a packet is dropped to mitigate a DoS attack
	PacketDropDOSPrevention PacketDropReason = "dos_prevention"
	// PacketDropUnsupportedVersion is used when a packet is dropped because the version is not supported
	PacketDropUnsupportedVersion PacketDropReason = "unsupported_version"
	// PacketDropUnexpectedPacket is used when an unexpected packet is received
	PacketDropUnexpectedPacket PacketDropReason = "unexpected_packet"
	// PacketDropUnexpectedSourceConnectionID is used when a packet with an unexpected source connection ID is received
	PacketDropUnexpectedSourceConnectionID PacketDropReason = "unexpected_source_connection_id"
	// PacketDropUnexpectedVersion is used when a packet with an unexpected version is received
	PacketDropUnexpectedVersion PacketDropReason = "unexpected_version"
	// PacketDropDuplicate is used when a duplicate packet is received
	PacketDropDuplicate PacketDropReason = "duplicate"
)

type PacketDropped

type PacketDropped struct {
	Header     PacketHeader
	Raw        RawInfo
	DatagramID DatagramID
	Trigger    PacketDropReason
}

PacketDropped is the transport:packet_dropped event.

func (PacketDropped) Encode

func (e PacketDropped) Encode(enc *jsontext.Encoder, _ time.Time) error

func (PacketDropped) Name

func (e PacketDropped) Name() string

type PacketHeader

type PacketHeader struct {
	PacketType       PacketType
	KeyPhaseBit      KeyPhaseBit
	PacketNumber     PacketNumber
	Version          Version
	SrcConnectionID  ConnectionID
	DestConnectionID ConnectionID
	Token            *Token
}

PacketHeader is a QUIC packet header.

type PacketHeaderVersionNegotiation

type PacketHeaderVersionNegotiation struct {
	SrcConnectionID  ArbitraryLenConnectionID
	DestConnectionID ArbitraryLenConnectionID
}

type PacketLossReason

type PacketLossReason string
const (
	// PacketLossReorderingThreshold is used when a packet is declared lost due to reordering threshold
	PacketLossReorderingThreshold PacketLossReason = "reordering_threshold"
	// PacketLossTimeThreshold is used when a packet is declared lost due to time threshold
	PacketLossTimeThreshold PacketLossReason = "time_threshold"
)

type PacketLost

type PacketLost struct {
	Header  PacketHeader
	Trigger PacketLossReason
}

func (PacketLost) Encode

func (e PacketLost) Encode(enc *jsontext.Encoder, _ time.Time) error

func (PacketLost) Name

func (e PacketLost) Name() string

type PacketNumber

type PacketNumber = protocol.PacketNumber

type PacketReceived

type PacketReceived struct {
	Header      PacketHeader
	Raw         RawInfo
	DatagramID  DatagramID
	Frames      []Frame
	ECN         ECN
	IsCoalesced bool
	Trigger     string
}

func (PacketReceived) Encode

func (e PacketReceived) Encode(enc *jsontext.Encoder, _ time.Time) error

func (PacketReceived) Name

func (e PacketReceived) Name() string

type PacketSent

type PacketSent struct {
	Header            PacketHeader
	Raw               RawInfo
	DatagramID        DatagramID
	Frames            []Frame
	ECN               ECN
	IsCoalesced       bool
	Trigger           string
	SupportedVersions []Version
}

func (PacketSent) Encode

func (e PacketSent) Encode(enc *jsontext.Encoder, _ time.Time) error

func (PacketSent) Name

func (e PacketSent) Name() string

type PacketType

type PacketType string
const (
	// PacketTypeInitial represents an Initial packet
	PacketTypeInitial PacketType = "initial"
	// PacketTypeHandshake represents a Handshake packet
	PacketTypeHandshake PacketType = "handshake"
	// PacketTypeRetry represents a Retry packet
	PacketTypeRetry PacketType = "retry"
	// PacketType0RTT represents a 0-RTT packet
	PacketType0RTT PacketType = "0RTT"
	// PacketTypeVersionNegotiation represents a Version Negotiation packet
	PacketTypeVersionNegotiation PacketType = "version_negotiation"
	// PacketTypeStatelessReset represents a Stateless Reset packet
	PacketTypeStatelessReset PacketType = "stateless_reset"
	// PacketType1RTT represents a 1-RTT packet
	PacketType1RTT PacketType = "1RTT"
)

func EncryptionLevelToPacketType

func EncryptionLevelToPacketType(l EncryptionLevel) PacketType

type ParametersSet

type ParametersSet struct {
	Restore                         bool
	Initiator                       Initiator
	SentBy                          protocol.Perspective
	OriginalDestinationConnectionID protocol.ConnectionID
	InitialSourceConnectionID       protocol.ConnectionID
	RetrySourceConnectionID         *protocol.ConnectionID
	StatelessResetToken             *protocol.StatelessResetToken
	DisableActiveMigration          bool
	MaxIdleTimeout                  time.Duration
	MaxUDPPayloadSize               protocol.ByteCount
	AckDelayExponent                uint8
	MaxAckDelay                     time.Duration
	ActiveConnectionIDLimit         uint64
	InitialMaxData                  protocol.ByteCount
	InitialMaxStreamDataBidiLocal   protocol.ByteCount
	InitialMaxStreamDataBidiRemote  protocol.ByteCount
	InitialMaxStreamDataUni         protocol.ByteCount
	InitialMaxStreamsBidi           int64
	InitialMaxStreamsUni            int64
	PreferredAddress                *PreferredAddress
	MaxDatagramFrameSize            protocol.ByteCount
	EnableResetStreamAt             bool
}

func (ParametersSet) Encode

func (e ParametersSet) Encode(enc *jsontext.Encoder, _ time.Time) error

func (ParametersSet) Name

func (e ParametersSet) Name() string

type PathChallengeFrame

type PathChallengeFrame = wire.PathChallengeFrame

A PathChallengeFrame is a PATH_CHALLENGE frame.

type PathEndpointInfo

type PathEndpointInfo struct {
	IPv4 netip.AddrPort
	IPv6 netip.AddrPort
}

type PathResponseFrame

type PathResponseFrame = wire.PathResponseFrame

A PathResponseFrame is a PATH_RESPONSE frame.

type PingFrame

type PingFrame = wire.PingFrame

A PingFrame is a PING frame.

type PreferredAddress

type PreferredAddress struct {
	IPv4, IPv6          netip.AddrPort
	ConnectionID        protocol.ConnectionID
	StatelessResetToken protocol.StatelessResetToken
}

type RawInfo

type RawInfo struct {
	Length        int // full packet length, including header and AEAD authentication tag
	PayloadLength int // length of the packet payload, excluding AEAD tag
}

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 SpuriousLoss

type SpuriousLoss struct {
	EncryptionLevel  protocol.EncryptionLevel
	PacketNumber     protocol.PacketNumber
	PacketReordering uint64
	TimeReordering   time.Duration
}

func (SpuriousLoss) Encode

func (e SpuriousLoss) Encode(enc *jsontext.Encoder, _ time.Time) error

func (SpuriousLoss) Name

func (e SpuriousLoss) Name() string

type StartedConnection

type StartedConnection struct {
	Local  PathEndpointInfo
	Remote PathEndpointInfo
}

func (StartedConnection) Encode

func (e StartedConnection) Encode(enc *jsontext.Encoder, _ time.Time) error

func (StartedConnection) Name

func (e StartedConnection) Name() string

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   int64
	Length   int64
	Fin      bool
}

A StreamFrame is a STREAM frame.

type StreamID

type StreamID = protocol.StreamID

type StreamsBlockedFrame

type StreamsBlockedFrame = wire.StreamsBlockedFrame

A StreamsBlockedFrame is a STREAMS_BLOCKED frame.

type TimerType

type TimerType string
const (
	// TimerTypeACK represents an ACK timer
	TimerTypeACK TimerType = "ack"
	// TimerTypePTO represents a PTO (Probe Timeout) timer
	TimerTypePTO TimerType = "pto"
	// TimerTypePathProbe represents a path probe timer
	TimerTypePathProbe TimerType = "path_probe"
)

type Token

type Token struct {
	Raw []byte
}

type TransportErrorCode

type TransportErrorCode = qerr.TransportErrorCode

type Version

type Version = protocol.Version

type VersionInformation

type VersionInformation struct {
	ClientVersions, ServerVersions []Version
	ChosenVersion                  Version
}

func (VersionInformation) Encode

func (e VersionInformation) Encode(enc *jsontext.Encoder, _ time.Time) error

func (VersionInformation) Name

func (e VersionInformation) Name() string

type VersionNegotiationReceived

type VersionNegotiationReceived struct {
	Header            PacketHeaderVersionNegotiation
	SupportedVersions []Version
}

func (VersionNegotiationReceived) Encode

func (VersionNegotiationReceived) Name

type VersionNegotiationSent

type VersionNegotiationSent struct {
	Header            PacketHeaderVersionNegotiation
	SupportedVersions []Version
}

func (VersionNegotiationSent) Encode

func (VersionNegotiationSent) Name

func (e VersionNegotiationSent) Name() string

Jump to

Keyboard shortcuts

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