wire

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeVersionNegotiation

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

ComposeVersionNegotiation composes a Version Negotiation

func LogFrame

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

LogFrame logs a frame, either sent or received

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

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

func (*AckFrame) Write

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

Write writes an ACK frame.

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
	ReasonPhrase       string
}

A ConnectionCloseFrame is a CONNECTION_CLOSE frame

func (*ConnectionCloseFrame) Length added in v0.8.0

Length of a written frame

func (*ConnectionCloseFrame) Write

type CryptoFrame added in v0.10.2

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

A CryptoFrame is a CRYPTO frame

func (*CryptoFrame) Length added in v0.10.2

Length of a written frame

func (*CryptoFrame) MaxDataLen added in v0.10.2

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

MaxDataLen returns the maximum data length

func (*CryptoFrame) Write added in v0.10.2

type DataBlockedFrame added in v0.10.2

type DataBlockedFrame struct {
	DataLimit protocol.ByteCount
}

A DataBlockedFrame is a DATA_BLOCKED frame

func (*DataBlockedFrame) Length added in v0.10.2

Length of a written frame

func (*DataBlockedFrame) Write added in v0.10.2

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

type ExtendedHeader added in v0.10.2

type ExtendedHeader struct {
	Header

	PacketNumberLen protocol.PacketNumberLen
	PacketNumber    protocol.PacketNumber

	KeyPhase int
	// contains filtered or unexported fields
}

ExtendedHeader is the header of a QUIC packet.

func (*ExtendedHeader) GetLength added in v0.10.2

GetLength determines the length of the Header.

func (*ExtendedHeader) Log added in v0.10.2

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

Log logs the Header

func (*ExtendedHeader) Write added in v0.10.2

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

func ParseNextFrame added in v0.8.0

func ParseNextFrame(r *bytes.Reader, v protocol.VersionNumber) (Frame, error)

ParseNextFrame parses the next frame It skips PADDING frames.

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 ParseHeader added in v0.10.2

func ParseHeader(b *bytes.Reader, shortHeaderConnIDLen int) (*Header, error)

ParseHeader parses the header. For short header packets: up to the packet number. For long header packets: * if we understand the version: up to the packet number * if not, only the invariant part of the header

func (*Header) IsVersionNegotiation

func (h *Header) IsVersionNegotiation() bool

IsVersionNegotiation says if this a version negotiation packet

func (*Header) ParseExtended added in v0.10.2

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 added in v0.10.2

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

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

type MaxDataFrame

type MaxDataFrame struct {
	ByteOffset protocol.ByteCount
}

A MaxDataFrame carries flow control information for the connection

func (*MaxDataFrame) Length added in v0.8.0

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

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

A MaxStreamDataFrame is a MAX_STREAM_DATA frame

func (*MaxStreamDataFrame) Length added in v0.8.0

Length of a written frame

func (*MaxStreamDataFrame) Write

type MaxStreamsFrame added in v0.10.2

type MaxStreamsFrame struct {
	Type       protocol.StreamType
	MaxStreams uint64
}

A MaxStreamsFrame is a MAX_STREAMS frame

func (*MaxStreamsFrame) Length added in v0.10.2

Length of a written frame

func (*MaxStreamsFrame) Write added in v0.10.2

type NewConnectionIDFrame added in v0.10.2

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

A NewConnectionIDFrame is a NEW_CONNECTION_ID frame

func (*NewConnectionIDFrame) Length added in v0.10.2

Length of a written frame

func (*NewConnectionIDFrame) Write added in v0.10.2

type NewTokenFrame added in v0.10.2

type NewTokenFrame struct {
	Token []byte
}

A NewTokenFrame is a NEW_TOKEN frame

func (*NewTokenFrame) Length added in v0.10.2

Length of a written frame

func (*NewTokenFrame) Write added in v0.10.2

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

Length of a written frame

func (*PathChallengeFrame) Write added in v0.8.0

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

Length of a written frame

func (*PathResponseFrame) Write added in v0.8.0

type PingFrame

type PingFrame struct{}

A PingFrame is a PING frame

func (*PingFrame) Length added in v0.8.0

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

Length of a written frame

func (*PingFrame) Write

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

type ResetStreamFrame added in v0.10.2

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.10.2

Length of a written frame

func (*ResetStreamFrame) Write added in v0.10.2

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

type RetireConnectionIDFrame added in v0.10.2

type RetireConnectionIDFrame struct {
	SequenceNumber uint64
}

A RetireConnectionIDFrame is a RETIRE_CONNECTION_ID frame

func (*RetireConnectionIDFrame) Length added in v0.10.2

Length of a written frame

func (*RetireConnectionIDFrame) Write added in v0.10.2

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

Length of a written frame

func (*StopSendingFrame) Write added in v0.7.0

type StreamDataBlockedFrame added in v0.10.2

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

A StreamDataBlockedFrame is a STREAM_DATA_BLOCKED frame

func (*StreamDataBlockedFrame) Length added in v0.10.2

Length of a written frame

func (*StreamDataBlockedFrame) Write added in v0.10.2

type StreamFrame

type StreamFrame struct {
	StreamID       protocol.StreamID
	FinBit         bool
	DataLenPresent bool
	Offset         protocol.ByteCount
	Data           []byte
}

A StreamFrame of QUIC

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

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, error)

MaybeSplitOffFrame splits a frame such that it is not bigger than n bytes. If n >= len(frame), nil is returned and nothing is modified.

func (*StreamFrame) Write

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

Write writes a STREAM frame

type StreamsBlockedFrame added in v0.10.2

type StreamsBlockedFrame struct {
	Type        protocol.StreamType
	StreamLimit uint64
}

A StreamsBlockedFrame is a STREAMS_BLOCKED frame

func (*StreamsBlockedFrame) Length added in v0.10.2

Length of a written frame

func (*StreamsBlockedFrame) Write added in v0.10.2

Jump to

Keyboard shortcuts

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