package wire
Import Path
github.com/quic-go/quic-go/internal/wire (on go.dev)
Dependency Relation
imports 16 packages, and imported by 4 packages
Involved Source Files
ack_frame.go
ack_frequency_frame.go
ack_range.go
connection_close_frame.go
crypto_frame.go
data_blocked_frame.go
datagram_frame.go
extended_header.go
frame.go
frame_parser.go
frame_type.go
handshake_done_frame.go
header.go
immediate_ack_frame.go
log.go
max_data_frame.go
max_stream_data_frame.go
max_streams_frame.go
new_connection_id_frame.go
new_token_frame.go
path_challenge_frame.go
path_response_frame.go
ping_frame.go
pool.go
reset_stream_frame.go
retire_connection_id_frame.go
short_header.go
stop_sending_frame.go
stream_data_blocked_frame.go
stream_frame.go
streams_blocked_frame.go
transport_parameters.go
version_negotiation.go
Package-Level Type Names (total 30)
An AckFrame is an ACK frame
// has to be ordered. The highest ACK range goes first, the lowest ACK range goes last
DelayTime time.Duration
ECNCE uint64
ECT0 uint64
ECT1 uint64
AcksPacket determines if this ACK frame acks a certain packet number
Append appends an ACK frame.
HasMissingRanges returns if this frame reports any missing packets
LargestAcked is the largest acked packet number
Length of a written frame
LowestAcked is the lowest acked packet number
(*AckFrame) Reset()
Truncate truncates the ACK frame to fit into maxSize,
and to at most 64 ACK ranges.
maxSize must be large enough to fit at least one ACK range.
*AckFrame : Frame
func (*FrameParser).ParseAckFrame(frameType FrameType, data []byte, encLevel protocol.EncryptionLevel, v protocol.Version) (*AckFrame, int, error)
func github.com/quic-go/quic-go/internal/ackhandler.(*ReceivedPacketHandler).GetAckFrame(encLevel protocol.EncryptionLevel, now monotime.Time, onlyIfQueued bool) *AckFrame
func github.com/quic-go/quic-go/internal/ackhandler.SentPacketHandler.ReceivedAck(f *AckFrame, encLevel protocol.EncryptionLevel, rcvTime monotime.Time) (bool, error)
AckElicitingThreshold uint64
ReorderingThreshold protocol.PacketNumber
RequestMaxAckDelay time.Duration
SequenceNumber uint64
(*AckFrequencyFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
(*AckFrequencyFrame) Length(_ protocol.Version) protocol.ByteCount
*AckFrequencyFrame : Frame
AckRange is an ACK range
Largest protocol.PacketNumber
Smallest protocol.PacketNumber
Len returns the number of packets contained in this ACK range
A ConnectionCloseFrame is a CONNECTION_CLOSE frame
ErrorCode uint64
FrameType uint64
IsApplicationError bool
ReasonPhrase string
(*ConnectionCloseFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*ConnectionCloseFrame : Frame
A CryptoFrame is a CRYPTO frame
Data []byte
Offset protocol.ByteCount
(*CryptoFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
MaxDataLen returns the maximum data length
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.
*CryptoFrame : Frame
func (*CryptoFrame).MaybeSplitOffFrame(maxSize protocol.ByteCount, version protocol.Version) (*CryptoFrame, bool)
A DataBlockedFrame is a DATA_BLOCKED frame
MaximumData protocol.ByteCount
(*DataBlockedFrame) Append(b []byte, version protocol.Version) ([]byte, error)
Length of a written frame
*DataBlockedFrame : Frame
A DatagramFrame is a DATAGRAM frame
Data []byte
DataLenPresent bool
(*DatagramFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
MaxDataLen returns the maximum data length
*DatagramFrame : Frame
func (*FrameParser).ParseDatagramFrame(frameType FrameType, data []byte, v protocol.Version) (*DatagramFrame, int, error)
ExtendedHeader is the header of a QUIC packet.
Header Header
Header.DestConnectionID protocol.ConnectionID
Header.Length protocol.ByteCount
Header.SrcConnectionID protocol.ConnectionID
Header.Token []byte
Header.Type protocol.PacketType
Header.Version protocol.Version
KeyPhase protocol.KeyPhaseBit
PacketNumber protocol.PacketNumber
PacketNumberLen protocol.PacketNumberLen
Append appends the Header.
GetLength determines the length of the Header.
Log logs the Header
PacketType is the type of the packet, for logging purposes
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.
ParsedLen returns the number of bytes that were consumed when parsing the header
func (*Header).ParseExtended(data []byte) (*ExtendedHeader, error)
A Frame in QUIC
( Frame) Append(b []byte, version protocol.Version) ([]byte, error)
( Frame) Length(version protocol.Version) protocol.ByteCount
*AckFrame
*AckFrequencyFrame
*ConnectionCloseFrame
*CryptoFrame
*DataBlockedFrame
*DatagramFrame
*HandshakeDoneFrame
*ImmediateAckFrame
*MaxDataFrame
*MaxStreamDataFrame
*MaxStreamsFrame
*NewConnectionIDFrame
*NewTokenFrame
*PathChallengeFrame
*PathResponseFrame
*PingFrame
*ResetStreamFrame
*RetireConnectionIDFrame
*StopSendingFrame
*StreamDataBlockedFrame
*StreamFrame
*StreamsBlockedFrame
func (*FrameParser).ParseLessCommonFrame(frameType FrameType, data []byte, v protocol.Version) (Frame, int, error)
func IsProbingFrame(f Frame) bool
func LogFrame(logger utils.Logger, frame Frame, sent bool)
func github.com/quic-go/quic-go/internal/ackhandler.IsFrameAckEliciting(f Frame) bool
func github.com/quic-go/quic-go/internal/ackhandler.FrameHandler.OnAcked(Frame)
func github.com/quic-go/quic-go/internal/ackhandler.FrameHandler.OnLost(Frame)
The FrameParser parses QUIC frames, one by one.
(*FrameParser) ParseAckFrame(frameType FrameType, data []byte, encLevel protocol.EncryptionLevel, v protocol.Version) (*AckFrame, int, error)
(*FrameParser) ParseDatagramFrame(frameType FrameType, data []byte, v protocol.Version) (*DatagramFrame, int, error)
ParseLessCommonFrame parses everything except STREAM, ACK or DATAGRAM.
These cases should be handled separately for performance reasons.
(*FrameParser) ParseStreamFrame(frameType FrameType, data []byte, v protocol.Version) (*StreamFrame, int, error)
ParseType parses the frame type of the next frame.
It skips over PADDING frames.
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.
func NewFrameParser(supportsDatagrams, supportsResetStreamAt, supportsAckFrequency bool) *FrameParser
( FrameType) IsAckFrameType() bool
( FrameType) IsDatagramFrameType() bool
( FrameType) IsStreamFrameType() bool
func (*FrameParser).ParseType(b []byte, encLevel protocol.EncryptionLevel) (FrameType, int, error)
func IsProbingFrameType(f FrameType) bool
func ParseStreamFrame(b []byte, typ FrameType, _ protocol.Version) (*StreamFrame, int, error)
func (*FrameParser).ParseAckFrame(frameType FrameType, data []byte, encLevel protocol.EncryptionLevel, v protocol.Version) (*AckFrame, int, error)
func (*FrameParser).ParseDatagramFrame(frameType FrameType, data []byte, v protocol.Version) (*DatagramFrame, int, error)
func (*FrameParser).ParseLessCommonFrame(frameType FrameType, data []byte, v protocol.Version) (Frame, int, error)
func (*FrameParser).ParseStreamFrame(frameType FrameType, data []byte, v protocol.Version) (*StreamFrame, int, error)
func github.com/quic-go/quic-go/internal/ackhandler.IsFrameTypeAckEliciting(t FrameType) bool
const FrameTypeAck
const FrameTypeAckECN
const FrameTypeAckFrequency
const FrameTypeApplicationClose
const FrameTypeBidiMaxStreams
const FrameTypeBidiStreamBlocked
const FrameTypeConnectionClose
const FrameTypeCrypto
const FrameTypeDataBlocked
const FrameTypeDatagramNoLength
const FrameTypeDatagramWithLength
const FrameTypeHandshakeDone
const FrameTypeImmediateAck
const FrameTypeMaxData
const FrameTypeMaxStreamData
const FrameTypeNewConnectionID
const FrameTypeNewToken
const FrameTypePathChallenge
const FrameTypePathResponse
const FrameTypePing
const FrameTypeResetStream
const FrameTypeResetStreamAt
const FrameTypeRetireConnectionID
const FrameTypeStopSending
const FrameTypeStreamDataBlocked
const FrameTypeUniMaxStreams
const FrameTypeUniStreamBlocked
A HandshakeDoneFrame is a HANDSHAKE_DONE frame
(*HandshakeDoneFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*HandshakeDoneFrame : Frame
The Header is the version independent part of the header
DestConnectionID protocol.ConnectionID
Length protocol.ByteCount
SrcConnectionID protocol.ConnectionID
Token []byte
Type protocol.PacketType
Version protocol.Version
PacketType is the type of the packet, for logging purposes
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.
ParsedLen returns the number of bytes that were consumed when parsing the header
func ParsePacket(data []byte) (*Header, []byte, []byte, error)
An ImmediateAckFrame is an IMMEDIATE_ACK frame
(*ImmediateAckFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*ImmediateAckFrame : Frame
A MaxDataFrame carries flow control information for the connection
MaximumData protocol.ByteCount
(*MaxDataFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*MaxDataFrame : Frame
A MaxStreamDataFrame is a MAX_STREAM_DATA frame
MaximumStreamData protocol.ByteCount
StreamID protocol.StreamID
(*MaxStreamDataFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*MaxStreamDataFrame : Frame
A MaxStreamsFrame is a MAX_STREAMS frame
MaxStreamNum protocol.StreamNum
Type protocol.StreamType
(*MaxStreamsFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*MaxStreamsFrame : Frame
A NewConnectionIDFrame is a NEW_CONNECTION_ID frame
ConnectionID protocol.ConnectionID
RetirePriorTo uint64
SequenceNumber uint64
StatelessResetToken protocol.StatelessResetToken
(*NewConnectionIDFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*NewConnectionIDFrame : Frame
A NewTokenFrame is a NEW_TOKEN frame
Token []byte
(*NewTokenFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*NewTokenFrame : Frame
A PathChallengeFrame is a PATH_CHALLENGE frame
Data [8]byte
(*PathChallengeFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*PathChallengeFrame : Frame
A PathResponseFrame is a PATH_RESPONSE frame
Data [8]byte
(*PathResponseFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*PathResponseFrame : Frame
A PingFrame is a PING frame
(*PingFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*PingFrame : Frame
PreferredAddress is the value encoding in the preferred_address transport parameter
ConnectionID protocol.ConnectionID
IPv4 netip.AddrPort
IPv6 netip.AddrPort
StatelessResetToken protocol.StatelessResetToken
A ResetStreamFrame is a RESET_STREAM or RESET_STREAM_AT frame in QUIC
ErrorCode qerr.StreamErrorCode
FinalSize protocol.ByteCount
ReliableSize protocol.ByteCount
StreamID protocol.StreamID
(*ResetStreamFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*ResetStreamFrame : Frame
A RetireConnectionIDFrame is a RETIRE_CONNECTION_ID frame
SequenceNumber uint64
(*RetireConnectionIDFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*RetireConnectionIDFrame : Frame
A StopSendingFrame is a STOP_SENDING frame
ErrorCode qerr.StreamErrorCode
StreamID protocol.StreamID
(*StopSendingFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*StopSendingFrame : Frame
A StreamDataBlockedFrame is a STREAM_DATA_BLOCKED frame
MaximumStreamData protocol.ByteCount
StreamID protocol.StreamID
(*StreamDataBlockedFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*StreamDataBlockedFrame : Frame
A StreamFrame of QUIC
Data []byte
DataLenPresent bool
Fin bool
Offset protocol.ByteCount
StreamID protocol.StreamID
(*StreamFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
DataLen gives the length of data in bytes
Length returns the total length of the STREAM frame
MaxDataLen returns the maximum data length
If 0 is returned, writing will fail (a STREAM frame must contain at least 1 byte of data).
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.
(*StreamFrame) PutBack()
*StreamFrame : Frame
func GetStreamFrame() *StreamFrame
func ParseStreamFrame(b []byte, typ FrameType, _ protocol.Version) (*StreamFrame, int, error)
func (*FrameParser).ParseStreamFrame(frameType FrameType, data []byte, v protocol.Version) (*StreamFrame, int, error)
func (*StreamFrame).MaybeSplitOffFrame(maxSize protocol.ByteCount, version protocol.Version) (*StreamFrame, bool)
A StreamsBlockedFrame is a STREAMS_BLOCKED frame
StreamLimit protocol.StreamNum
Type protocol.StreamType
(*StreamsBlockedFrame) Append(b []byte, _ protocol.Version) ([]byte, error)
Length of a written frame
*StreamsBlockedFrame : Frame
TransportParameters are parameters sent to the peer during the handshake
AckDelayExponent uint8
ActiveConnectionIDLimit uint64
DisableActiveMigration bool
// https://datatracker.ietf.org/doc/draft-ietf-quic-reliable-stream-reset/06/
InitialMaxData protocol.ByteCount
InitialMaxStreamDataBidiLocal protocol.ByteCount
InitialMaxStreamDataBidiRemote protocol.ByteCount
InitialMaxStreamDataUni protocol.ByteCount
InitialSourceConnectionID protocol.ConnectionID
MaxAckDelay time.Duration
MaxBidiStreamNum protocol.StreamNum
// RFC 9221
MaxIdleTimeout time.Duration
MaxUDPPayloadSize protocol.ByteCount
MaxUniStreamNum protocol.StreamNum
MinAckDelay *time.Duration
OriginalDestinationConnectionID protocol.ConnectionID
PreferredAddress *PreferredAddress
// use a pointer here to distinguish zero-length connection IDs from missing transport parameters
StatelessResetToken *protocol.StatelessResetToken
Marshal the transport parameters
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.
String returns a string representation, intended for logging.
Unmarshal the transport parameters
UnmarshalFromSessionTicket unmarshals transport parameters from a session ticket.
ValidFor0RTT checks if the transport parameters match those saved in the session ticket.
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.
*TransportParameters : expvar.Var
*TransportParameters : fmt.Stringer
func (*TransportParameters).ValidFor0RTT(saved *TransportParameters) bool
func (*TransportParameters).ValidForUpdate(saved *TransportParameters) bool
func github.com/quic-go/quic-go/internal/handshake.NewCryptoSetupClient(connID protocol.ConnectionID, tp *TransportParameters, tlsConf *tls.Config, enable0RTT bool, rttStats *utils.RTTStats, qlogger qlogwriter.Recorder, logger utils.Logger, version protocol.Version) handshake.CryptoSetup
func github.com/quic-go/quic-go/internal/handshake.NewCryptoSetupServer(connID protocol.ConnectionID, localAddr, remoteAddr net.Addr, tp *TransportParameters, tlsConf *tls.Config, allow0RTT bool, rttStats *utils.RTTStats, qlogger qlogwriter.Recorder, logger utils.Logger, version protocol.Version) handshake.CryptoSetup
Package-Level Functions (total 20)
AppendShortHeader writes a short header.
ComposeVersionNegotiation composes a Version Negotiation
func GetStreamFrame() *StreamFrame
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.
IsLongHeaderPacket says if this is a Long Header packet
func IsPotentialQUICPacket(firstByte byte) bool
IsProbingFrame returns true if the frame is a probing frame.
See section 9.1 of RFC 9000.
IsProbingFrameType returns true if the FrameType is a probing frame.
See section 9.1 of RFC 9000.
IsVersionNegotiationPacket says if this is a version negotiation packet
LogFrame logs a frame, either sent or received
func LogShortHeader(logger utils.Logger, dest protocol.ConnectionID, pn protocol.PacketNumber, pnLen protocol.PacketNumberLen, kp protocol.KeyPhaseBit)
NewFrameParser creates a new frame parser.
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.
ParseConnectionID parses the destination connection ID of a packet.
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.
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 ParseStreamFrame(b []byte, typ FrameType, _ protocol.Version) (*StreamFrame, int, error)
ParseVersion parses the QUIC version.
It should only be called for Long Header packets (Short Header packets don't contain a version number).
ParseVersionNegotiationPacket parses a Version Negotiation packet.
func ShortHeaderLen(dest protocol.ConnectionID, pnLen protocol.PacketNumberLen) protocol.ByteCount
Package-Level Variables (total 4)
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.
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.
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.
Package-Level Constants (total 27)
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
These constants correspond to those defined in RFC 9000.
Stream frame types are not listed explicitly here; use FrameType.IsStreamFrameType() to identify them.
![]() |
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. |