Documentation ¶
Index ¶
- Variables
- func ComposeVersionNegotiation(destConnID, srcConnID protocol.ConnectionID, versions []protocol.VersionNumber) ([]byte, error)
- func IsVersionNegotiationPacket(b []byte) bool
- func LogFrame(logger utils.Logger, frame Frame, sent bool)
- func ParseConnectionID(data []byte, shortHeaderConnIDLen int) (protocol.ConnectionID, error)
- type AckFrame
- func (f *AckFrame) AcksPacket(p protocol.PacketNumber) bool
- func (f *AckFrame) HasMissingRanges() bool
- func (f *AckFrame) LargestAcked() protocol.PacketNumber
- func (f *AckFrame) Length(version protocol.VersionNumber) protocol.ByteCount
- func (f *AckFrame) LowestAcked() protocol.PacketNumber
- func (f *AckFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
- type AckRange
- type ConnectionCloseFrame
- type CryptoFrame
- func (f *CryptoFrame) Length(_ protocol.VersionNumber) protocol.ByteCount
- func (f *CryptoFrame) MaxDataLen(maxSize protocol.ByteCount) protocol.ByteCount
- func (f *CryptoFrame) MaybeSplitOffFrame(maxSize protocol.ByteCount, version protocol.VersionNumber) (*CryptoFrame, bool)
- func (f *CryptoFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
- type DataBlockedFrame
- type ExtendedHeader
- type Frame
- type FrameParser
- type HandshakeDoneFrame
- type Header
- type MaxDataFrame
- type MaxStreamDataFrame
- type MaxStreamsFrame
- type NewConnectionIDFrame
- type NewTokenFrame
- type PathChallengeFrame
- type PathResponseFrame
- type PingFrame
- type PreferredAddress
- type ResetStreamFrame
- type RetireConnectionIDFrame
- type StopSendingFrame
- type StreamDataBlockedFrame
- type StreamFrame
- func (f *StreamFrame) DataLen() protocol.ByteCount
- func (f *StreamFrame) Length(version protocol.VersionNumber) protocol.ByteCount
- func (f *StreamFrame) MaxDataLen(maxSize protocol.ByteCount, version protocol.VersionNumber) protocol.ByteCount
- func (f *StreamFrame) MaybeSplitOffFrame(maxSize protocol.ByteCount, version protocol.VersionNumber) (*StreamFrame, bool)
- func (f *StreamFrame) PutBack()
- func (f *StreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
- type StreamsBlockedFrame
- type TransportParameters
- func (p *TransportParameters) Marshal() []byte
- func (p *TransportParameters) MarshalForSessionTicket(b *bytes.Buffer)
- func (p *TransportParameters) String() string
- func (p *TransportParameters) Unmarshal(data []byte, sentBy protocol.Perspective) error
- func (p *TransportParameters) UnmarshalFromSessionTicket(data []byte) error
- func (p *TransportParameters) ValidFor0RTT(tp *TransportParameters) bool
Constants ¶
This section is empty.
Variables ¶
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.
var ErrUnsupportedVersion = errors.New("unsupported version")
Functions ¶
func ComposeVersionNegotiation ¶
func ComposeVersionNegotiation(destConnID, srcConnID protocol.ConnectionID, versions []protocol.VersionNumber) ([]byte, error)
ComposeVersionNegotiation composes a Version Negotiation
func IsVersionNegotiationPacket ¶ added in v0.11.0
IsVersionNegotiationPacket says if this is a version negotiation packet
func ParseConnectionID ¶ added in v0.11.0
func ParseConnectionID(data []byte, shortHeaderConnIDLen int) (protocol.ConnectionID, error)
ParseConnectionID parses the destination connection ID of a packet. It uses the data slice for the connection ID. That means that the connection ID must not be used after the packet buffer is released.
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 }
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) HasMissingRanges ¶
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 v0.8.0
func (f *AckFrame) Length(version protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*AckFrame) LowestAcked ¶
func (f *AckFrame) LowestAcked() protocol.PacketNumber
LowestAcked is the lowest acked packet number
type AckRange ¶
type AckRange struct { Smallest protocol.PacketNumber Largest protocol.PacketNumber }
AckRange is an ACK range
func (AckRange) Len ¶ added in v0.8.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 qerr.ErrorCode FrameType uint64 ReasonPhrase string }
A ConnectionCloseFrame is a CONNECTION_CLOSE frame
func (*ConnectionCloseFrame) Length ¶ added in v0.8.0
func (f *ConnectionCloseFrame) Length(version protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*ConnectionCloseFrame) Write ¶
func (f *ConnectionCloseFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
type CryptoFrame ¶ added in v0.11.0
A CryptoFrame is a CRYPTO frame
func (*CryptoFrame) Length ¶ added in v0.11.0
func (f *CryptoFrame) Length(_ protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*CryptoFrame) MaxDataLen ¶ added in v0.11.0
func (f *CryptoFrame) MaxDataLen(maxSize protocol.ByteCount) protocol.ByteCount
MaxDataLen returns the maximum data length
func (*CryptoFrame) MaybeSplitOffFrame ¶ added in v0.15.0
func (f *CryptoFrame) MaybeSplitOffFrame(maxSize protocol.ByteCount, version protocol.VersionNumber) (*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.
func (*CryptoFrame) Write ¶ added in v0.11.0
func (f *CryptoFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type DataBlockedFrame ¶ added in v0.11.0
A DataBlockedFrame is a DATA_BLOCKED frame
func (*DataBlockedFrame) Length ¶ added in v0.11.0
func (f *DataBlockedFrame) Length(version protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*DataBlockedFrame) Write ¶ added in v0.11.0
func (f *DataBlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
type ExtendedHeader ¶ added in v0.11.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) GetLength ¶ added in v0.11.0
func (h *ExtendedHeader) GetLength(v protocol.VersionNumber) protocol.ByteCount
GetLength determines the length of the Header.
func (*ExtendedHeader) Log ¶ added in v0.11.0
func (h *ExtendedHeader) Log(logger utils.Logger)
Log logs the Header
func (*ExtendedHeader) ParsedLen ¶ added in v0.15.0
func (h *ExtendedHeader) ParsedLen() protocol.ByteCount
ParsedLen returns the number of bytes that were consumed when parsing the header
func (*ExtendedHeader) Write ¶ added in v0.11.0
func (h *ExtendedHeader) Write(b *bytes.Buffer, ver protocol.VersionNumber) error
Write writes the Header.
type Frame ¶
type Frame interface { Write(b *bytes.Buffer, version protocol.VersionNumber) error Length(version protocol.VersionNumber) protocol.ByteCount }
A Frame in QUIC
type FrameParser ¶ added in v0.11.0
type FrameParser interface { ParseNext(*bytes.Reader, protocol.EncryptionLevel) (Frame, error) SetAckDelayExponent(uint8) }
A FrameParser parses QUIC frames, one by one.
func NewFrameParser ¶ added in v0.11.0
func NewFrameParser(v protocol.VersionNumber) FrameParser
NewFrameParser creates a new frame parser.
type HandshakeDoneFrame ¶ added in v0.15.0
type HandshakeDoneFrame struct{}
A HandshakeDoneFrame is a HANDSHAKE_DONE frame
func (*HandshakeDoneFrame) Length ¶ added in v0.15.0
func (f *HandshakeDoneFrame) Length(_ protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*HandshakeDoneFrame) Write ¶ added in v0.15.0
func (f *HandshakeDoneFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type Header ¶
type Header struct { IsLongHeader bool Type protocol.PacketType Version protocol.VersionNumber SrcConnectionID protocol.ConnectionID DestConnectionID protocol.ConnectionID Length protocol.ByteCount Token []byte SupportedVersions []protocol.VersionNumber // sent in a Version Negotiation Packet // contains filtered or unexported fields }
The Header is the version independent part of the header
func ParsePacket ¶ added in v0.11.0
ParsePacket parses a packet. If the packet has a long header, the packet is cut according to the length field. If we understand the version, the packet is header up unto the packet number. Otherwise, only the invariant part of the header is parsed.
func (*Header) PacketType ¶ added in v0.14.0
PacketType is the type of the packet, for logging purposes
func (*Header) ParseExtended ¶ added in v0.11.0
func (h *Header) ParseExtended(b *bytes.Reader, ver protocol.VersionNumber) (*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.
type MaxDataFrame ¶
A MaxDataFrame carries flow control information for the connection
func (*MaxDataFrame) Length ¶ added in v0.8.0
func (f *MaxDataFrame) Length(version protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*MaxDataFrame) Write ¶
func (f *MaxDataFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
Write writes a MAX_STREAM_DATA frame
type MaxStreamDataFrame ¶
A MaxStreamDataFrame is a MAX_STREAM_DATA frame
func (*MaxStreamDataFrame) Length ¶ added in v0.8.0
func (f *MaxStreamDataFrame) Length(version protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*MaxStreamDataFrame) Write ¶
func (f *MaxStreamDataFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
type MaxStreamsFrame ¶ added in v0.11.0
type MaxStreamsFrame struct { Type protocol.StreamType MaxStreamNum protocol.StreamNum }
A MaxStreamsFrame is a MAX_STREAMS frame
func (*MaxStreamsFrame) Length ¶ added in v0.11.0
func (f *MaxStreamsFrame) Length(protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*MaxStreamsFrame) Write ¶ added in v0.11.0
func (f *MaxStreamsFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type NewConnectionIDFrame ¶ added in v0.11.0
type NewConnectionIDFrame struct { SequenceNumber uint64 RetirePriorTo uint64 ConnectionID protocol.ConnectionID StatelessResetToken [16]byte }
A NewConnectionIDFrame is a NEW_CONNECTION_ID frame
func (*NewConnectionIDFrame) Length ¶ added in v0.11.0
func (f *NewConnectionIDFrame) Length(protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*NewConnectionIDFrame) Write ¶ added in v0.11.0
func (f *NewConnectionIDFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type NewTokenFrame ¶ added in v0.11.0
type NewTokenFrame struct {
Token []byte
}
A NewTokenFrame is a NEW_TOKEN frame
func (*NewTokenFrame) Length ¶ added in v0.11.0
func (f *NewTokenFrame) Length(protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*NewTokenFrame) Write ¶ added in v0.11.0
func (f *NewTokenFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type PathChallengeFrame ¶ added in v0.8.0
type PathChallengeFrame struct {
Data [8]byte
}
A PathChallengeFrame is a PATH_CHALLENGE frame
func (*PathChallengeFrame) Length ¶ added in v0.8.0
func (f *PathChallengeFrame) Length(_ protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*PathChallengeFrame) Write ¶ added in v0.8.0
func (f *PathChallengeFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type PathResponseFrame ¶ added in v0.8.0
type PathResponseFrame struct {
Data [8]byte
}
A PathResponseFrame is a PATH_RESPONSE frame
func (*PathResponseFrame) Length ¶ added in v0.8.0
func (f *PathResponseFrame) Length(_ protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*PathResponseFrame) Write ¶ added in v0.8.0
func (f *PathResponseFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type PingFrame ¶
type PingFrame struct{}
A PingFrame is a PING frame
type PreferredAddress ¶ added in v0.15.3
type PreferredAddress struct { IPv4 net.IP IPv4Port uint16 IPv6 net.IP IPv6Port uint16 ConnectionID protocol.ConnectionID StatelessResetToken [16]byte }
PreferredAddress is the value encoding in the preferred_address transport parameter
type ResetStreamFrame ¶ added in v0.11.0
type ResetStreamFrame struct { StreamID protocol.StreamID ErrorCode protocol.ApplicationErrorCode ByteOffset protocol.ByteCount }
A ResetStreamFrame is a RESET_STREAM frame in QUIC
func (*ResetStreamFrame) Length ¶ added in v0.11.0
func (f *ResetStreamFrame) Length(version protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*ResetStreamFrame) Write ¶ added in v0.11.0
func (f *ResetStreamFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type RetireConnectionIDFrame ¶ added in v0.11.0
type RetireConnectionIDFrame struct {
SequenceNumber uint64
}
A RetireConnectionIDFrame is a RETIRE_CONNECTION_ID frame
func (*RetireConnectionIDFrame) Length ¶ added in v0.11.0
func (f *RetireConnectionIDFrame) Length(protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*RetireConnectionIDFrame) Write ¶ added in v0.11.0
func (f *RetireConnectionIDFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type StopSendingFrame ¶ added in v0.7.0
type StopSendingFrame struct { StreamID protocol.StreamID ErrorCode protocol.ApplicationErrorCode }
A StopSendingFrame is a STOP_SENDING frame
func (*StopSendingFrame) Length ¶ added in v0.8.0
func (f *StopSendingFrame) Length(_ protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*StopSendingFrame) Write ¶ added in v0.7.0
func (f *StopSendingFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type StreamDataBlockedFrame ¶ added in v0.11.0
A StreamDataBlockedFrame is a STREAM_DATA_BLOCKED frame
func (*StreamDataBlockedFrame) Length ¶ added in v0.11.0
func (f *StreamDataBlockedFrame) Length(version protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*StreamDataBlockedFrame) Write ¶ added in v0.11.0
func (f *StreamDataBlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
type StreamFrame ¶
type StreamFrame struct { StreamID protocol.StreamID Offset protocol.ByteCount Data []byte FinBit bool DataLenPresent bool // contains filtered or unexported fields }
A StreamFrame of QUIC
func GetStreamFrame ¶ added in v0.13.0
func GetStreamFrame() *StreamFrame
func (*StreamFrame) DataLen ¶
func (f *StreamFrame) DataLen() protocol.ByteCount
DataLen gives the length of data in bytes
func (*StreamFrame) Length ¶ added in v0.8.0
func (f *StreamFrame) Length(version protocol.VersionNumber) protocol.ByteCount
Length returns the total length of the STREAM frame
func (*StreamFrame) MaxDataLen ¶ added in v0.8.0
func (f *StreamFrame) MaxDataLen(maxSize protocol.ByteCount, version protocol.VersionNumber) 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 v0.8.0
func (f *StreamFrame) MaybeSplitOffFrame(maxSize protocol.ByteCount, version protocol.VersionNumber) (*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 v0.13.0
func (f *StreamFrame) PutBack()
func (*StreamFrame) Write ¶
func (f *StreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
Write writes a STREAM frame
type StreamsBlockedFrame ¶ added in v0.11.0
type StreamsBlockedFrame struct { Type protocol.StreamType StreamLimit protocol.StreamNum }
A StreamsBlockedFrame is a STREAMS_BLOCKED frame
func (*StreamsBlockedFrame) Length ¶ added in v0.11.0
func (f *StreamsBlockedFrame) Length(_ protocol.VersionNumber) protocol.ByteCount
Length of a written frame
func (*StreamsBlockedFrame) Write ¶ added in v0.11.0
func (f *StreamsBlockedFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
type TransportParameters ¶ added in v0.15.3
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 StatelessResetToken *[16]byte OriginalConnectionID protocol.ConnectionID ActiveConnectionIDLimit uint64 }
TransportParameters are parameters sent to the peer during the handshake
func (*TransportParameters) Marshal ¶ added in v0.15.3
func (p *TransportParameters) Marshal() []byte
Marshal the transport parameters
func (*TransportParameters) MarshalForSessionTicket ¶ added in v0.15.3
func (p *TransportParameters) MarshalForSessionTicket(b *bytes.Buffer)
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 v0.15.3
func (p *TransportParameters) String() string
String returns a string representation, intended for logging.
func (*TransportParameters) Unmarshal ¶ added in v0.15.3
func (p *TransportParameters) Unmarshal(data []byte, sentBy protocol.Perspective) error
Unmarshal the transport parameters
func (*TransportParameters) UnmarshalFromSessionTicket ¶ added in v0.15.3
func (p *TransportParameters) UnmarshalFromSessionTicket(data []byte) error
UnmarshalFromSessionTicket unmarshals transport parameters from a session ticket.
func (*TransportParameters) ValidFor0RTT ¶ added in v0.15.3
func (p *TransportParameters) ValidFor0RTT(tp *TransportParameters) bool
ValidFor0RTT checks if the transport parameters match those saved in the session ticket.
Source Files ¶
- ack_frame.go
- ack_range.go
- connection_close_frame.go
- crypto_frame.go
- data_blocked_frame.go
- extended_header.go
- frame_parser.go
- handshake_done_frame.go
- header.go
- interface.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
- stop_sending_frame.go
- stream_data_blocked_frame.go
- stream_frame.go
- streams_blocked_frame.go
- transport_parameters.go
- version_negotiation.go