quic-go: github.com/lucas-clemente/quic-go/internal/wire Index | Files

package wire

import "github.com/lucas-clemente/quic-go/internal/wire"

Index

Package Files

ack_frame.go ack_range.go connection_close_frame.go crypto_frame.go data_blocked_frame.go extended_header.go frame_parser.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 version_negotiation.go

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.

func ComposeVersionNegotiation Uses

func ComposeVersionNegotiation(destConnID, srcConnID protocol.ConnectionID, versions []protocol.VersionNumber) ([]byte, error)

ComposeVersionNegotiation composes a Version Negotiation

func IsVersionNegotiationPacket Uses

func IsVersionNegotiationPacket(b []byte) bool

IsVersionNegotiationPacket says if this is a version negotiation packet

func LogFrame Uses

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

LogFrame logs a frame, either sent or received

func ParseConnectionID Uses

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.

type AckFrame Uses

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 Uses

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

AcksPacket determines if this ACK frame acks a certain packet number

func (*AckFrame) HasMissingRanges Uses

func (f *AckFrame) HasMissingRanges() bool

HasMissingRanges returns if this frame reports any missing packets

func (*AckFrame) LargestAcked Uses

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

LargestAcked is the largest acked packet number

func (*AckFrame) Length Uses

func (f *AckFrame) Length(version protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*AckFrame) LowestAcked Uses

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

LowestAcked is the lowest acked packet number

func (*AckFrame) Write Uses

func (f *AckFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

Write writes an ACK frame.

type AckRange Uses

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

AckRange is an ACK range

func (AckRange) Len Uses

func (r AckRange) Len() protocol.PacketNumber

Len returns the number of packets contained in this ACK range

type ConnectionCloseFrame Uses

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

A ConnectionCloseFrame is a CONNECTION_CLOSE frame

func (*ConnectionCloseFrame) Length Uses

func (f *ConnectionCloseFrame) Length(version protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*ConnectionCloseFrame) Write Uses

func (f *ConnectionCloseFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

type CryptoFrame Uses

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

A CryptoFrame is a CRYPTO frame

func (*CryptoFrame) Length Uses

func (f *CryptoFrame) Length(_ protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*CryptoFrame) MaxDataLen Uses

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

MaxDataLen returns the maximum data length

func (*CryptoFrame) Write Uses

func (f *CryptoFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error

type DataBlockedFrame Uses

type DataBlockedFrame struct {
    DataLimit protocol.ByteCount
}

A DataBlockedFrame is a DATA_BLOCKED frame

func (*DataBlockedFrame) Length Uses

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

Length of a written frame

func (*DataBlockedFrame) Write Uses

func (f *DataBlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

type ExtendedHeader Uses

type ExtendedHeader struct {
    Header

    PacketNumberLen protocol.PacketNumberLen
    PacketNumber    protocol.PacketNumber

    KeyPhase protocol.KeyPhaseBit
    // contains filtered or unexported fields
}

ExtendedHeader is the header of a QUIC packet.

func (*ExtendedHeader) GetLength Uses

func (h *ExtendedHeader) GetLength(v protocol.VersionNumber) protocol.ByteCount

GetLength determines the length of the Header.

func (*ExtendedHeader) Log Uses

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

Log logs the Header

func (*ExtendedHeader) Write Uses

func (h *ExtendedHeader) Write(b *bytes.Buffer, ver protocol.VersionNumber) error

Write writes the Header.

type Frame Uses

type Frame interface {
    Write(b *bytes.Buffer, version protocol.VersionNumber) error
    Length(version protocol.VersionNumber) protocol.ByteCount
}

A Frame in QUIC

type FrameParser Uses

type FrameParser interface {
    ParseNext(*bytes.Reader, protocol.EncryptionLevel) (Frame, error)
    SetAckDelayExponent(uint8)
}

A FrameParser parses QUIC frames, one by one.

func NewFrameParser Uses

func NewFrameParser(v protocol.VersionNumber) FrameParser

NewFrameParser creates a new frame parser.

type Header struct {
    Version          protocol.VersionNumber
    SrcConnectionID  protocol.ConnectionID
    DestConnectionID protocol.ConnectionID

    IsLongHeader bool
    Type         protocol.PacketType
    Length       protocol.ByteCount

    Token                []byte
    SupportedVersions    []protocol.VersionNumber // sent in a Version Negotiation Packet
    OrigDestConnectionID protocol.ConnectionID    // sent in the Retry packet
    // contains filtered or unexported fields
}

The Header is the version independent part of the header

func ParsePacket Uses

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

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) ParseExtended Uses

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.

func (*Header) ParsedLen Uses

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

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

type MaxDataFrame Uses

type MaxDataFrame struct {
    ByteOffset protocol.ByteCount
}

A MaxDataFrame carries flow control information for the connection

func (*MaxDataFrame) Length Uses

func (f *MaxDataFrame) Length(version protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*MaxDataFrame) Write Uses

func (f *MaxDataFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

Write writes a MAX_STREAM_DATA frame

type MaxStreamDataFrame Uses

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

A MaxStreamDataFrame is a MAX_STREAM_DATA frame

func (*MaxStreamDataFrame) Length Uses

func (f *MaxStreamDataFrame) Length(version protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*MaxStreamDataFrame) Write Uses

func (f *MaxStreamDataFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

type MaxStreamsFrame Uses

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

A MaxStreamsFrame is a MAX_STREAMS frame

func (*MaxStreamsFrame) Length Uses

func (f *MaxStreamsFrame) Length(protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*MaxStreamsFrame) Write Uses

func (f *MaxStreamsFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error

type NewConnectionIDFrame Uses

type NewConnectionIDFrame struct {
    SequenceNumber      uint64
    RetirePriorTo       uint64
    ConnectionID        protocol.ConnectionID
    StatelessResetToken [16]byte
}

A NewConnectionIDFrame is a NEW_CONNECTION_ID frame

func (*NewConnectionIDFrame) Length Uses

func (f *NewConnectionIDFrame) Length(protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*NewConnectionIDFrame) Write Uses

func (f *NewConnectionIDFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error

type NewTokenFrame Uses

type NewTokenFrame struct {
    Token []byte
}

A NewTokenFrame is a NEW_TOKEN frame

func (*NewTokenFrame) Length Uses

func (f *NewTokenFrame) Length(protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*NewTokenFrame) Write Uses

func (f *NewTokenFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error

type PathChallengeFrame Uses

type PathChallengeFrame struct {
    Data [8]byte
}

A PathChallengeFrame is a PATH_CHALLENGE frame

func (*PathChallengeFrame) Length Uses

func (f *PathChallengeFrame) Length(_ protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*PathChallengeFrame) Write Uses

func (f *PathChallengeFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error

type PathResponseFrame Uses

type PathResponseFrame struct {
    Data [8]byte
}

A PathResponseFrame is a PATH_RESPONSE frame

func (*PathResponseFrame) Length Uses

func (f *PathResponseFrame) Length(_ protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*PathResponseFrame) Write Uses

func (f *PathResponseFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error

type PingFrame Uses

type PingFrame struct{}

A PingFrame is a PING frame

func (*PingFrame) Length Uses

func (f *PingFrame) Length(version protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*PingFrame) Write Uses

func (f *PingFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

type ResetStreamFrame Uses

type ResetStreamFrame struct {
    StreamID   protocol.StreamID
    ErrorCode  protocol.ApplicationErrorCode
    ByteOffset protocol.ByteCount
}

A ResetStreamFrame is a RESET_STREAM frame in QUIC

func (*ResetStreamFrame) Length Uses

func (f *ResetStreamFrame) Length(version protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*ResetStreamFrame) Write Uses

func (f *ResetStreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

type RetireConnectionIDFrame Uses

type RetireConnectionIDFrame struct {
    SequenceNumber uint64
}

A RetireConnectionIDFrame is a RETIRE_CONNECTION_ID frame

func (*RetireConnectionIDFrame) Length Uses

func (f *RetireConnectionIDFrame) Length(protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*RetireConnectionIDFrame) Write Uses

func (f *RetireConnectionIDFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error

type StopSendingFrame Uses

type StopSendingFrame struct {
    StreamID  protocol.StreamID
    ErrorCode protocol.ApplicationErrorCode
}

A StopSendingFrame is a STOP_SENDING frame

func (*StopSendingFrame) Length Uses

func (f *StopSendingFrame) Length(_ protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*StopSendingFrame) Write Uses

func (f *StopSendingFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error

type StreamDataBlockedFrame Uses

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

A StreamDataBlockedFrame is a STREAM_DATA_BLOCKED frame

func (*StreamDataBlockedFrame) Length Uses

func (f *StreamDataBlockedFrame) Length(version protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*StreamDataBlockedFrame) Write Uses

func (f *StreamDataBlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

type StreamFrame Uses

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

A StreamFrame of QUIC

func GetStreamFrame Uses

func GetStreamFrame() *StreamFrame

func (*StreamFrame) DataLen Uses

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

DataLen gives the length of data in bytes

func (*StreamFrame) Length Uses

func (f *StreamFrame) Length(version protocol.VersionNumber) protocol.ByteCount

Length returns the total length of the STREAM frame

func (*StreamFrame) MaxDataLen Uses

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 Uses

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 Uses

func (f *StreamFrame) PutBack()

func (*StreamFrame) Write Uses

func (f *StreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error

Write writes a STREAM frame

type StreamsBlockedFrame Uses

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

A StreamsBlockedFrame is a STREAMS_BLOCKED frame

func (*StreamsBlockedFrame) Length Uses

func (f *StreamsBlockedFrame) Length(_ protocol.VersionNumber) protocol.ByteCount

Length of a written frame

func (*StreamsBlockedFrame) Write Uses

func (f *StreamsBlockedFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error

Package wire imports 13 packages (graph) and is imported by 18 packages. Updated 2019-09-13. Refresh now. Tools for package owners.