wire

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeGQUICVersionNegotiation

func ComposeGQUICVersionNegotiation(connID protocol.ConnectionID, versions []protocol.VersionNumber) []byte

ComposeGQUICVersionNegotiation composes a Version Negotiation Packet for gQUIC

func ComposeVersionNegotiation

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

ComposeVersionNegotiation composes a Version Negotiation according to the IETF draft

func LogFrame

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

LogFrame logs a frame, either sent or received

func WritePublicReset

func WritePublicReset(connectionID protocol.ConnectionID, rejectedPacketNumber protocol.PacketNumber, nonceProof uint64) []byte

WritePublicReset writes a PUBLIC_RESET

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

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

func (r AckRange) Len() protocol.PacketNumber

Len returns the number of packets contained in this ACK range

type BlockedFrame

type BlockedFrame struct {
	Offset protocol.ByteCount
}

A BlockedFrame is a BLOCKED frame

func (*BlockedFrame) Length added in v0.7.1

Length of a written frame

func (*BlockedFrame) Write

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

type ConnectionCloseFrame

type ConnectionCloseFrame struct {
	ErrorCode    qerr.ErrorCode
	ReasonPhrase string
}

A ConnectionCloseFrame in QUIC

func (*ConnectionCloseFrame) Length added in v0.7.1

Length of a written frame

func (*ConnectionCloseFrame) Write

Write writes an CONNECTION_CLOSE frame.

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

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

ParseNextFrame parses the next frame It skips PADDING frames.

type GoawayFrame

type GoawayFrame struct {
	ErrorCode      qerr.ErrorCode
	LastGoodStream protocol.StreamID
	ReasonPhrase   string
}

A GoawayFrame is a GOAWAY frame

func (*GoawayFrame) Length added in v0.7.1

Length of a written frame

func (*GoawayFrame) Write

type Header struct {
	IsPublicHeader bool

	Raw []byte

	Version protocol.VersionNumber

	DestConnectionID protocol.ConnectionID
	SrcConnectionID  protocol.ConnectionID
	OmitConnectionID bool

	PacketNumberLen protocol.PacketNumberLen
	PacketNumber    protocol.PacketNumber

	IsVersionNegotiation bool
	SupportedVersions    []protocol.VersionNumber // Version Number sent in a Version Negotiation Packet by the server

	// only needed for the gQUIC Public Header
	VersionFlag          bool
	ResetFlag            bool
	DiversificationNonce []byte

	// only needed for the IETF Header
	Type         protocol.PacketType
	IsLongHeader bool
	KeyPhase     int
	PayloadLen   protocol.ByteCount

	// spin stuff
	HasSpinBit bool
	SpinBit    bool
	VEC        byte
}

Header is the header of a QUIC packet. It contains fields that are only needed for the gQUIC Public Header and the IETF draft Header.

func ParseHeaderSentByClient

func ParseHeaderSentByClient(b *bytes.Reader) (*Header, error)

ParseHeaderSentByClient parses the header for a packet that was sent by the client.

func ParseHeaderSentByServer

func ParseHeaderSentByServer(b *bytes.Reader) (*Header, error)

ParseHeaderSentByServer parses the header for a packet that was sent by the server.

func (*Header) GetLength

func (h *Header) GetLength(pers protocol.Perspective, version protocol.VersionNumber) (protocol.ByteCount, error)

GetLength determines the length of the Header.

func (*Header) Log

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

Log logs the Header

func (*Header) Write

func (h *Header) Write(b *bytes.Buffer, pers protocol.Perspective, version protocol.VersionNumber) error

Write writes 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.7.1

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 carries flow control information for a stream

func (*MaxStreamDataFrame) Length added in v0.7.1

Length of a written frame

func (*MaxStreamDataFrame) Write

Write writes a MAX_STREAM_DATA frame

type MaxStreamIDFrame added in v0.7.0

type MaxStreamIDFrame struct {
	StreamID protocol.StreamID
}

A MaxStreamIDFrame is a MAX_STREAM_ID frame

func (*MaxStreamIDFrame) Length added in v0.7.1

Length of a written frame

func (*MaxStreamIDFrame) Write added in v0.7.0

type PathChallengeFrame added in v0.7.1

type PathChallengeFrame struct {
	Data [8]byte
}

A PathChallengeFrame is a PATH_CHALLENGE frame

func (*PathChallengeFrame) Length added in v0.7.1

Length of a written frame

func (*PathChallengeFrame) Write added in v0.7.1

type PathResponseFrame added in v0.7.1

type PathResponseFrame struct {
	Data [8]byte
}

A PathResponseFrame is a PATH_RESPONSE frame

func (*PathResponseFrame) Length added in v0.7.1

Length of a written frame

func (*PathResponseFrame) Write added in v0.7.1

type PingFrame

type PingFrame struct{}

A PingFrame is a ping frame

func (*PingFrame) Length added in v0.7.1

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 PublicReset

type PublicReset struct {
	RejectedPacketNumber protocol.PacketNumber
	Nonce                uint64
}

A PublicReset is a PUBLIC_RESET

func ParsePublicReset

func ParsePublicReset(r *bytes.Reader) (*PublicReset, error)

ParsePublicReset parses a PUBLIC_RESET

type RstStreamFrame

type RstStreamFrame struct {
	StreamID protocol.StreamID
	// The error code is a uint32 in gQUIC, but a uint16 in IETF QUIC.
	// protocol.ApplicaitonErrorCode is a uint16, so larger values in gQUIC frames will be truncated.
	ErrorCode  protocol.ApplicationErrorCode
	ByteOffset protocol.ByteCount
}

A RstStreamFrame is a RST_STREAM frame in QUIC

func (*RstStreamFrame) Length added in v0.7.1

Length of a written frame

func (*RstStreamFrame) Write

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

Write writes a RST_STREAM frame

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

Length of a written frame

func (*StopSendingFrame) Write added in v0.7.0

type StopWaitingFrame

type StopWaitingFrame struct {
	LeastUnacked    protocol.PacketNumber
	PacketNumberLen protocol.PacketNumberLen
	// PacketNumber is the packet number of the packet that this StopWaitingFrame will be sent with
	PacketNumber protocol.PacketNumber
}

A StopWaitingFrame in QUIC

func (*StopWaitingFrame) Length added in v0.7.1

Length of a written frame

func (*StopWaitingFrame) Write

type StreamBlockedFrame

type StreamBlockedFrame struct {
	StreamID protocol.StreamID
	Offset   protocol.ByteCount
}

A StreamBlockedFrame in QUIC

func (*StreamBlockedFrame) Length added in v0.7.1

Length of a written frame

func (*StreamBlockedFrame) Write

Write writes a STREAM_BLOCKED frame

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

Length returns the total length of the STREAM frame

func (*StreamFrame) MaxDataLen added in v0.7.1

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

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

type StreamIDBlockedFrame struct {
	StreamID protocol.StreamID
}

A StreamIDBlockedFrame is a STREAM_ID_BLOCKED frame

func (*StreamIDBlockedFrame) Length added in v0.7.1

Length of a written frame

func (*StreamIDBlockedFrame) Write added in v0.7.0

Jump to

Keyboard shortcuts

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