wire

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdditionalTransportParametersClient map[uint64][]byte

AdditionalTransportParametersClient are additional transport parameters that will be added to the client's transport parameters. This is not intended for production use, but _only_ to increase the size of the ClientHello beyond the usual size of less than 1 MTU.

View Source
var ErrInvalidReservedBits = errors.New("invalid reserved bits")

ErrInvalidReservedBits is returned when the reserved bits are incorrect. When this error is returned, parsing continues, and an ExtendedHeader is returned. This is necessary because we need to decrypt the packet in that case, in order to avoid a timing side-channel.

View Source
var ErrUnsupportedVersion = errors.New("unsupported version")
View Source
var MaxDatagramSize protocol.ByteCount = 16383

MaxDatagramSize is the maximum size of a DATAGRAM frame (RFC 9221). By setting it to a large value, we allow all datagrams that fit into a QUIC packet. The value is chosen such that it can still be encoded as a 2 byte varint. This is a var and not a const so it can be set in tests.

Functions

func AppendShortHeader added in v1.0.0

func AppendShortHeader(b []byte, connID protocol.ConnectionID, pn protocol.PacketNumber, pnLen protocol.PacketNumberLen, kp protocol.KeyPhaseBit) ([]byte, error)

AppendShortHeader writes a short header.

func ComposeVersionNegotiation

func ComposeVersionNegotiation(destConnID, srcConnID protocol.ArbitraryLenConnectionID, versions []protocol.Version) []byte

ComposeVersionNegotiation composes a Version Negotiation

func Is0RTTPacket added in v1.0.0

func Is0RTTPacket(b []byte) bool

Is0RTTPacket says if this is a 0-RTT packet. A packet sent with a version we don't understand can never be a 0-RTT packet.

func IsLongHeaderPacket added in v1.0.0

func IsLongHeaderPacket(firstByte byte) bool

IsLongHeaderPacket says if this is a Long Header packet

func IsPotentialQUICPacket added in v1.0.0

func IsPotentialQUICPacket(firstByte byte) bool

func IsProbingFrame added in v1.0.0

func IsProbingFrame(f Frame) bool

IsProbingFrame returns true if the frame is a probing frame. See section 9.1 of RFC 9000.

func IsProbingFrameType added in v1.0.7

func IsProbingFrameType(f FrameType) bool

IsProbingFrameType returns true if the FrameType is a probing frame. See section 9.1 of RFC 9000.

func IsVersionNegotiationPacket added in v1.0.0

func IsVersionNegotiationPacket(b []byte) bool

IsVersionNegotiationPacket says if this is a version negotiation packet

func LogFrame

func LogFrame(logger utils.Logger, frame Frame, sent bool)

LogFrame logs a frame, either sent or received

func LogShortHeader added in v1.0.0

func ParseArbitraryLenConnectionIDs added in v1.0.0

func ParseArbitraryLenConnectionIDs(data []byte) (bytesParsed int, dest, src protocol.ArbitraryLenConnectionID, _ error)

ParseArbitraryLenConnectionIDs parses the most general form of a Long Header packet, using only the version-independent packet format as described in Section 5.1 of RFC 8999: https://datatracker.ietf.org/doc/html/rfc8999#section-5.1. This function should only be called on Long Header packets for which we don't support the version.

func ParseConnectionID added in v1.0.0

func ParseConnectionID(data []byte, shortHeaderConnIDLen int) (protocol.ConnectionID, error)

ParseConnectionID parses the destination connection ID of a packet.

func ParseShortHeader added in v1.0.0

func ParseShortHeader(data []byte, connIDLen int) (length int, _ protocol.PacketNumber, _ protocol.PacketNumberLen, _ protocol.KeyPhaseBit, _ error)

ParseShortHeader parses a short header packet. It must be called after header protection was removed. Otherwise, the check for the reserved bits will (most likely) fail.

func ParseVersion added in v1.0.0

func ParseVersion(data []byte) (protocol.Version, error)

ParseVersion parses the QUIC version. It should only be called for Long Header packets (Short Header packets don't contain a version number).

func ParseVersionNegotiationPacket added in v1.0.0

func ParseVersionNegotiationPacket(b []byte) (dest, src protocol.ArbitraryLenConnectionID, _ []protocol.Version, _ error)

ParseVersionNegotiationPacket parses a Version Negotiation packet.

func ShortHeaderLen added in v1.0.0

func ShortHeaderLen(dest protocol.ConnectionID, pnLen protocol.PacketNumberLen) protocol.ByteCount

Types

type AckFrame

type AckFrame struct {
	AckRanges []AckRange // has to be ordered. The highest ACK range goes first, the lowest ACK range goes last
	DelayTime time.Duration

	ECT0, ECT1, ECNCE uint64
}

An AckFrame is an ACK frame

func (*AckFrame) AcksPacket

func (f *AckFrame) AcksPacket(p protocol.PacketNumber) bool

AcksPacket determines if this ACK frame acks a certain packet number

func (*AckFrame) Append added in v1.0.0

func (f *AckFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

Append appends an ACK frame.

func (*AckFrame) HasMissingRanges

func (f *AckFrame) HasMissingRanges() bool

HasMissingRanges returns if this frame reports any missing packets

func (*AckFrame) LargestAcked

func (f *AckFrame) LargestAcked() protocol.PacketNumber

LargestAcked is the largest acked packet number

func (*AckFrame) Length added in v1.0.0

Length of a written frame

func (*AckFrame) LowestAcked

func (f *AckFrame) LowestAcked() protocol.PacketNumber

LowestAcked is the lowest acked packet number

func (*AckFrame) Reset added in v1.0.0

func (f *AckFrame) Reset()

type AckFrequencyFrame added in v1.0.7

type AckFrequencyFrame struct {
	SequenceNumber        uint64
	AckElicitingThreshold uint64
	RequestMaxAckDelay    time.Duration
	ReorderingThreshold   protocol.PacketNumber
}

func (*AckFrequencyFrame) Append added in v1.0.7

func (f *AckFrequencyFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*AckFrequencyFrame) Length added in v1.0.7

type AckRange

type AckRange struct {
	Smallest protocol.PacketNumber
	Largest  protocol.PacketNumber
}

AckRange is an ACK range

func (AckRange) Len added in v1.0.0

func (r AckRange) Len() protocol.PacketNumber

Len returns the number of packets contained in this ACK range

type ConnectionCloseFrame

type ConnectionCloseFrame struct {
	IsApplicationError bool
	ErrorCode          uint64
	FrameType          uint64
	ReasonPhrase       string
}

A ConnectionCloseFrame is a CONNECTION_CLOSE frame

func (*ConnectionCloseFrame) Append added in v1.0.0

func (f *ConnectionCloseFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*ConnectionCloseFrame) Length added in v1.0.0

Length of a written frame

type CryptoFrame added in v1.0.0

type CryptoFrame struct {
	Offset protocol.ByteCount
	Data   []byte
}

A CryptoFrame is a CRYPTO frame

func (*CryptoFrame) Append added in v1.0.0

func (f *CryptoFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*CryptoFrame) Length added in v1.0.0

Length of a written frame

func (*CryptoFrame) MaxDataLen added in v1.0.0

func (f *CryptoFrame) MaxDataLen(maxSize protocol.ByteCount) protocol.ByteCount

MaxDataLen returns the maximum data length

func (*CryptoFrame) MaybeSplitOffFrame added in v1.0.0

func (f *CryptoFrame) MaybeSplitOffFrame(maxSize protocol.ByteCount, version protocol.Version) (*CryptoFrame, bool)

MaybeSplitOffFrame splits a frame such that it is not bigger than n bytes. It returns if the frame was actually split. The frame might not be split if: * the size is large enough to fit the whole frame * the size is too small to fit even a 1-byte frame. In that case, the frame returned is nil.

type DataBlockedFrame added in v1.0.0

type DataBlockedFrame struct {
	MaximumData protocol.ByteCount
}

A DataBlockedFrame is a DATA_BLOCKED frame

func (*DataBlockedFrame) Append added in v1.0.0

func (f *DataBlockedFrame) Append(b []byte, version protocol.Version) ([]byte, error)

func (*DataBlockedFrame) Length added in v1.0.0

func (f *DataBlockedFrame) Length(version protocol.Version) protocol.ByteCount

Length of a written frame

type DatagramFrame added in v1.0.0

type DatagramFrame struct {
	DataLenPresent bool
	Data           []byte
}

A DatagramFrame is a DATAGRAM frame

func (*DatagramFrame) Append added in v1.0.0

func (f *DatagramFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*DatagramFrame) Length added in v1.0.0

Length of a written frame

func (*DatagramFrame) MaxDataLen added in v1.0.0

func (f *DatagramFrame) MaxDataLen(maxSize protocol.ByteCount, version protocol.Version) protocol.ByteCount

MaxDataLen returns the maximum data length

type ExtendedHeader added in v1.0.0

type ExtendedHeader struct {
	Header

	KeyPhase protocol.KeyPhaseBit

	PacketNumberLen protocol.PacketNumberLen
	PacketNumber    protocol.PacketNumber
	// contains filtered or unexported fields
}

ExtendedHeader is the header of a QUIC packet.

func (*ExtendedHeader) Append added in v1.0.0

func (h *ExtendedHeader) Append(b []byte, v protocol.Version) ([]byte, error)

Append appends the Header.

func (*ExtendedHeader) GetLength added in v1.0.0

GetLength determines the length of the Header.

func (*ExtendedHeader) Log added in v1.0.0

func (h *ExtendedHeader) Log(logger utils.Logger)

Log logs the Header

func (*ExtendedHeader) ParsedLen added in v1.0.0

func (h *ExtendedHeader) ParsedLen() protocol.ByteCount

ParsedLen returns the number of bytes that were consumed when parsing the header

type Frame

type Frame interface {
	Append(b []byte, version protocol.Version) ([]byte, error)
	Length(version protocol.Version) protocol.ByteCount
}

A Frame in QUIC

type FrameParser added in v1.0.0

type FrameParser struct {
	// contains filtered or unexported fields
}

The FrameParser parses QUIC frames, one by one.

func NewFrameParser added in v1.0.0

func NewFrameParser(supportsDatagrams, supportsResetStreamAt, supportsAckFrequency bool) *FrameParser

NewFrameParser creates a new frame parser.

func (*FrameParser) ParseAckFrame added in v1.0.7

func (p *FrameParser) ParseAckFrame(frameType FrameType, data []byte, encLevel protocol.EncryptionLevel, v protocol.Version) (*AckFrame, int, error)

func (*FrameParser) ParseDatagramFrame added in v1.0.7

func (p *FrameParser) ParseDatagramFrame(frameType FrameType, data []byte, v protocol.Version) (*DatagramFrame, int, error)

func (*FrameParser) ParseLessCommonFrame added in v1.0.7

func (p *FrameParser) ParseLessCommonFrame(frameType FrameType, data []byte, v protocol.Version) (Frame, int, error)

ParseLessCommonFrame parses everything except STREAM, ACK or DATAGRAM. These cases should be handled separately for performance reasons.

func (*FrameParser) ParseStreamFrame added in v1.0.7

func (p *FrameParser) ParseStreamFrame(frameType FrameType, data []byte, v protocol.Version) (*StreamFrame, int, error)

func (*FrameParser) ParseType added in v1.0.7

func (p *FrameParser) ParseType(b []byte, encLevel protocol.EncryptionLevel) (FrameType, int, error)

ParseType parses the frame type of the next frame. It skips over PADDING frames.

func (*FrameParser) SetAckDelayExponent added in v1.0.0

func (p *FrameParser) SetAckDelayExponent(exp uint8)

SetAckDelayExponent sets the acknowledgment delay exponent (sent in the transport parameters). This value is used to scale the ACK Delay field in the ACK frame.

type FrameType added in v1.0.7

type FrameType uint64
const (
	FrameTypePing        FrameType = 0x1
	FrameTypeAck         FrameType = 0x2
	FrameTypeAckECN      FrameType = 0x3
	FrameTypeResetStream FrameType = 0x4
	FrameTypeStopSending FrameType = 0x5
	FrameTypeCrypto      FrameType = 0x6
	FrameTypeNewToken    FrameType = 0x7

	FrameTypeMaxData            FrameType = 0x10
	FrameTypeMaxStreamData      FrameType = 0x11
	FrameTypeBidiMaxStreams     FrameType = 0x12
	FrameTypeUniMaxStreams      FrameType = 0x13
	FrameTypeDataBlocked        FrameType = 0x14
	FrameTypeStreamDataBlocked  FrameType = 0x15
	FrameTypeBidiStreamBlocked  FrameType = 0x16
	FrameTypeUniStreamBlocked   FrameType = 0x17
	FrameTypeNewConnectionID    FrameType = 0x18
	FrameTypeRetireConnectionID FrameType = 0x19
	FrameTypePathChallenge      FrameType = 0x1a
	FrameTypePathResponse       FrameType = 0x1b
	FrameTypeConnectionClose    FrameType = 0x1c
	FrameTypeApplicationClose   FrameType = 0x1d
	FrameTypeHandshakeDone      FrameType = 0x1e
	// https://datatracker.ietf.org/doc/draft-ietf-quic-reliable-stream-reset/07/
	FrameTypeResetStreamAt FrameType = 0x24
	// https://datatracker.ietf.org/doc/draft-ietf-quic-ack-frequency/11/
	FrameTypeAckFrequency FrameType = 0xaf
	FrameTypeImmediateAck FrameType = 0x1f

	FrameTypeDatagramNoLength   FrameType = 0x30
	FrameTypeDatagramWithLength FrameType = 0x31
)

These constants correspond to those defined in RFC 9000. Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.

func (FrameType) IsAckFrameType added in v1.0.7

func (t FrameType) IsAckFrameType() bool

func (FrameType) IsDatagramFrameType added in v1.0.7

func (t FrameType) IsDatagramFrameType() bool

func (FrameType) IsStreamFrameType added in v1.0.7

func (t FrameType) IsStreamFrameType() bool

type HandshakeDoneFrame added in v1.0.0

type HandshakeDoneFrame struct{}

A HandshakeDoneFrame is a HANDSHAKE_DONE frame

func (*HandshakeDoneFrame) Append added in v1.0.0

func (f *HandshakeDoneFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*HandshakeDoneFrame) Length added in v1.0.0

Length of a written frame

type Header struct {
	Type protocol.PacketType

	Version          protocol.Version
	SrcConnectionID  protocol.ConnectionID
	DestConnectionID protocol.ConnectionID

	Length protocol.ByteCount

	Token []byte
	// contains filtered or unexported fields
}

The Header is the version independent part of the header

func ParsePacket added in v1.0.0

func ParsePacket(data []byte) (*Header, []byte, []byte, error)

ParsePacket parses a long header packet. The packet is cut according to the length field. If we understand the version, the packet is parsed up unto the packet number. Otherwise, only the invariant part of the header is parsed.

func (*Header) PacketType added in v1.0.0

func (h *Header) PacketType() string

PacketType is the type of the packet, for logging purposes

func (*Header) ParseExtended added in v1.0.0

func (h *Header) ParseExtended(data []byte) (*ExtendedHeader, error)

ParseExtended parses the version dependent part of the header. The Reader has to be set such that it points to the first byte of the header.

func (*Header) ParsedLen added in v1.0.0

func (h *Header) ParsedLen() protocol.ByteCount

ParsedLen returns the number of bytes that were consumed when parsing the header

type ImmediateAckFrame added in v1.0.7

type ImmediateAckFrame struct{}

An ImmediateAckFrame is an IMMEDIATE_ACK frame

func (*ImmediateAckFrame) Append added in v1.0.7

func (f *ImmediateAckFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*ImmediateAckFrame) Length added in v1.0.7

Length of a written frame

type MaxDataFrame

type MaxDataFrame struct {
	MaximumData protocol.ByteCount
}

A MaxDataFrame carries flow control information for the connection

func (*MaxDataFrame) Append added in v1.0.0

func (f *MaxDataFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*MaxDataFrame) Length added in v1.0.0

Length of a written frame

type MaxStreamDataFrame

type MaxStreamDataFrame struct {
	StreamID          protocol.StreamID
	MaximumStreamData protocol.ByteCount
}

A MaxStreamDataFrame is a MAX_STREAM_DATA frame

func (*MaxStreamDataFrame) Append added in v1.0.0

func (f *MaxStreamDataFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*MaxStreamDataFrame) Length added in v1.0.0

Length of a written frame

type MaxStreamsFrame added in v1.0.0

type MaxStreamsFrame struct {
	Type         protocol.StreamType
	MaxStreamNum protocol.StreamNum
}

A MaxStreamsFrame is a MAX_STREAMS frame

func (*MaxStreamsFrame) Append added in v1.0.0

func (f *MaxStreamsFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*MaxStreamsFrame) Length added in v1.0.0

Length of a written frame

type NewConnectionIDFrame added in v1.0.0

type NewConnectionIDFrame struct {
	SequenceNumber      uint64
	RetirePriorTo       uint64
	ConnectionID        protocol.ConnectionID
	StatelessResetToken protocol.StatelessResetToken
}

A NewConnectionIDFrame is a NEW_CONNECTION_ID frame

func (*NewConnectionIDFrame) Append added in v1.0.0

func (f *NewConnectionIDFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*NewConnectionIDFrame) Length added in v1.0.0

Length of a written frame

type NewTokenFrame added in v1.0.0

type NewTokenFrame struct {
	Token []byte
}

A NewTokenFrame is a NEW_TOKEN frame

func (*NewTokenFrame) Append added in v1.0.0

func (f *NewTokenFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*NewTokenFrame) Length added in v1.0.0

Length of a written frame

type PathChallengeFrame added in v1.0.0

type PathChallengeFrame struct {
	Data [8]byte
}

A PathChallengeFrame is a PATH_CHALLENGE frame

func (*PathChallengeFrame) Append added in v1.0.0

func (f *PathChallengeFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*PathChallengeFrame) Length added in v1.0.0

Length of a written frame

type PathResponseFrame added in v1.0.0

type PathResponseFrame struct {
	Data [8]byte
}

A PathResponseFrame is a PATH_RESPONSE frame

func (*PathResponseFrame) Append added in v1.0.0

func (f *PathResponseFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*PathResponseFrame) Length added in v1.0.0

Length of a written frame

type PingFrame

type PingFrame struct{}

A PingFrame is a PING frame

func (*PingFrame) Append added in v1.0.0

func (f *PingFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*PingFrame) Length added in v1.0.0

Length of a written frame

type PreferredAddress added in v1.0.0

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

PreferredAddress is the value encoding in the preferred_address transport parameter

type ResetStreamFrame added in v1.0.0

type ResetStreamFrame struct {
	StreamID     protocol.StreamID
	ErrorCode    qerr.StreamErrorCode
	FinalSize    protocol.ByteCount
	ReliableSize protocol.ByteCount
}

A ResetStreamFrame is a RESET_STREAM or RESET_STREAM_AT frame in QUIC

func (*ResetStreamFrame) Append added in v1.0.0

func (f *ResetStreamFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*ResetStreamFrame) Length added in v1.0.0

Length of a written frame

type RetireConnectionIDFrame added in v1.0.0

type RetireConnectionIDFrame struct {
	SequenceNumber uint64
}

A RetireConnectionIDFrame is a RETIRE_CONNECTION_ID frame

func (*RetireConnectionIDFrame) Append added in v1.0.0

func (f *RetireConnectionIDFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*RetireConnectionIDFrame) Length added in v1.0.0

Length of a written frame

type StopSendingFrame added in v0.7.0

type StopSendingFrame struct {
	StreamID  protocol.StreamID
	ErrorCode qerr.StreamErrorCode
}

A StopSendingFrame is a STOP_SENDING frame

func (*StopSendingFrame) Append added in v1.0.0

func (f *StopSendingFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*StopSendingFrame) Length added in v1.0.0

Length of a written frame

type StreamDataBlockedFrame added in v1.0.0

type StreamDataBlockedFrame struct {
	StreamID          protocol.StreamID
	MaximumStreamData protocol.ByteCount
}

A StreamDataBlockedFrame is a STREAM_DATA_BLOCKED frame

func (*StreamDataBlockedFrame) Append added in v1.0.0

func (f *StreamDataBlockedFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*StreamDataBlockedFrame) Length added in v1.0.0

Length of a written frame

type StreamFrame

type StreamFrame struct {
	StreamID       protocol.StreamID
	Offset         protocol.ByteCount
	Data           []byte
	Fin            bool
	DataLenPresent bool
	// contains filtered or unexported fields
}

A StreamFrame of QUIC

func GetStreamFrame added in v1.0.0

func GetStreamFrame() *StreamFrame

func ParseStreamFrame

func ParseStreamFrame(b []byte, typ FrameType, _ protocol.Version) (*StreamFrame, int, error)

func (*StreamFrame) Append added in v1.0.0

func (f *StreamFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*StreamFrame) DataLen

func (f *StreamFrame) DataLen() protocol.ByteCount

DataLen gives the length of data in bytes

func (*StreamFrame) Length added in v1.0.0

Length returns the total length of the STREAM frame

func (*StreamFrame) MaxDataLen added in v1.0.0

func (f *StreamFrame) MaxDataLen(maxSize protocol.ByteCount, _ protocol.Version) protocol.ByteCount

MaxDataLen returns the maximum data length If 0 is returned, writing will fail (a STREAM frame must contain at least 1 byte of data).

func (*StreamFrame) MaybeSplitOffFrame added in v1.0.0

func (f *StreamFrame) MaybeSplitOffFrame(maxSize protocol.ByteCount, version protocol.Version) (*StreamFrame, bool)

MaybeSplitOffFrame splits a frame such that it is not bigger than n bytes. It returns if the frame was actually split. The frame might not be split if: * the size is large enough to fit the whole frame * the size is too small to fit even a 1-byte frame. In that case, the frame returned is nil.

func (*StreamFrame) PutBack added in v1.0.0

func (f *StreamFrame) PutBack()

type StreamsBlockedFrame added in v1.0.0

type StreamsBlockedFrame struct {
	Type        protocol.StreamType
	StreamLimit protocol.StreamNum
}

A StreamsBlockedFrame is a STREAMS_BLOCKED frame

func (*StreamsBlockedFrame) Append added in v1.0.0

func (f *StreamsBlockedFrame) Append(b []byte, _ protocol.Version) ([]byte, error)

func (*StreamsBlockedFrame) Length added in v1.0.0

Length of a written frame

type TransportParameters added in v1.0.0

type TransportParameters struct {
	InitialMaxStreamDataBidiLocal  protocol.ByteCount
	InitialMaxStreamDataBidiRemote protocol.ByteCount
	InitialMaxStreamDataUni        protocol.ByteCount
	InitialMaxData                 protocol.ByteCount

	MaxAckDelay      time.Duration
	AckDelayExponent uint8

	DisableActiveMigration bool

	MaxUDPPayloadSize protocol.ByteCount

	MaxUniStreamNum  protocol.StreamNum
	MaxBidiStreamNum protocol.StreamNum

	MaxIdleTimeout time.Duration

	PreferredAddress *PreferredAddress

	OriginalDestinationConnectionID protocol.ConnectionID
	InitialSourceConnectionID       protocol.ConnectionID
	RetrySourceConnectionID         *protocol.ConnectionID // use a pointer here to distinguish zero-length connection IDs from missing transport parameters

	StatelessResetToken     *protocol.StatelessResetToken
	ActiveConnectionIDLimit uint64

	MaxDatagramFrameSize protocol.ByteCount // RFC 9221
	EnableResetStreamAt  bool               // https://datatracker.ietf.org/doc/draft-ietf-quic-reliable-stream-reset/06/
	MinAckDelay          *time.Duration
}

TransportParameters are parameters sent to the peer during the handshake

func (*TransportParameters) Marshal added in v1.0.0

func (p *TransportParameters) Marshal(pers protocol.Perspective) []byte

Marshal the transport parameters

func (*TransportParameters) MarshalForSessionTicket added in v1.0.0

func (p *TransportParameters) MarshalForSessionTicket(b []byte) []byte

MarshalForSessionTicket marshals the transport parameters we save in the session ticket. When sending a 0-RTT enabled TLS session tickets, we need to save the transport parameters. The client will remember the transport parameters used in the last session, and apply those to the 0-RTT data it sends. Saving the transport parameters in the ticket gives the server the option to reject 0-RTT if the transport parameters changed. Since the session ticket is encrypted, the serialization format is defined by the server. For convenience, we use the same format that we also use for sending the transport parameters.

func (*TransportParameters) String added in v1.0.0

func (p *TransportParameters) String() string

String returns a string representation, intended for logging.

func (*TransportParameters) Unmarshal added in v1.0.0

func (p *TransportParameters) Unmarshal(data []byte, sentBy protocol.Perspective) error

Unmarshal the transport parameters

func (*TransportParameters) UnmarshalFromSessionTicket added in v1.0.0

func (p *TransportParameters) UnmarshalFromSessionTicket(b []byte) error

UnmarshalFromSessionTicket unmarshals transport parameters from a session ticket.

func (*TransportParameters) ValidFor0RTT added in v1.0.0

func (p *TransportParameters) ValidFor0RTT(saved *TransportParameters) bool

ValidFor0RTT checks if the transport parameters match those saved in the session ticket.

func (*TransportParameters) ValidForUpdate added in v1.0.0

func (p *TransportParameters) ValidForUpdate(saved *TransportParameters) bool

ValidForUpdate checks that the new transport parameters don't reduce limits after resuming a 0-RTT connection. It is only used on the client side.

Jump to

Keyboard shortcuts

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