Documentation ¶
Index ¶
- Variables
- func ComposeVersionNegotiation(connectionID protocol.ConnectionID, versions []protocol.VersionNumber) []byte
- func LogFrame(frame Frame, sent bool)
- func PeekConnectionID(b *bytes.Reader, packetSentBy protocol.Perspective) (protocol.ConnectionID, error)
- func WritePublicReset(connectionID protocol.ConnectionID, rejectedPacketNumber protocol.PacketNumber, ...) []byte
- type AckFrame
- type AckRange
- type AddAddressFrame
- type BlockedFrame
- type ClosePathFrame
- type ConnectionCloseFrame
- type Frame
- type GoawayFrame
- type PathsFrame
- type PingFrame
- type PublicHeader
- type PublicReset
- type RstStreamFrame
- type StopWaitingFrame
- type StreamFrame
- type WindowUpdateFrame
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidAckRanges occurs when a client sends inconsistent ACK ranges ErrInvalidAckRanges = errors.New("AckFrame: ACK frame contains invalid ACK ranges") // ErrInvalidFirstAckRange occurs when the first ACK range contains no packets ErrInvalidFirstAckRange = errors.New("AckFrame: ACK frame has invalid first ACK range") )
var ( ErrTooManyPaths = errors.New("PathsFrame: more paths than the maximum enabled") ErrPathsNumber = errors.New("PathsFrame: number of paths advertised and # of paths do not match") ErrMissingRTT = errors.New("PathsFrame: number of paths IDs and number of remote RTTs do not match") )
var ( // ErrPacketWithUnknownVersion occurs when a packet with an unknown version is parsed. // This can happen when the server is restarted. The client will send a packet without a version number. ErrPacketWithUnknownVersion = errors.New("PublicHeader: Received a packet without version number, that we don't know the version for") )
var (
ErrUnknownIPVersion = errors.New("AddAddressFrame: unknown IP version")
)
Functions ¶
func ComposeVersionNegotiation ¶
func ComposeVersionNegotiation(connectionID protocol.ConnectionID, versions []protocol.VersionNumber) []byte
ComposeVersionNegotiation composes a Version Negotiation Packet
func PeekConnectionID ¶
func PeekConnectionID(b *bytes.Reader, packetSentBy protocol.Perspective) (protocol.ConnectionID, error)
PeekConnectionID parses the connection ID from a QUIC packet's public header. If no error occurs, it restores the read position in the bytes.Reader.
func WritePublicReset ¶
func WritePublicReset(connectionID protocol.ConnectionID, rejectedPacketNumber protocol.PacketNumber, nonceProof uint64) []byte
WritePublicReset writes a Public Reset
Types ¶
type AckFrame ¶
type AckFrame struct { PathID protocol.PathID LargestAcked protocol.PacketNumber LowestAcked protocol.PacketNumber AckRanges []AckRange // has to be ordered. The highest ACK range goes first, the lowest ACK range goes last // time when the LargestAcked was receiveid // this field Will not be set for received ACKs frames PacketReceivedTime time.Time DelayTime time.Duration }
An AckFrame is an ACK frame in QUIC
func ParseAckFrame ¶
ParseAckFrame reads 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
type AckRange ¶
type AckRange struct { First protocol.PacketNumber Last protocol.PacketNumber }
AckRange is an ACK range
type AddAddressFrame ¶
A AddAddressFrame in QUIC
func ParseAddAddressFrame ¶
func ParseAddAddressFrame(r *bytes.Reader, version protocol.VersionNumber) (*AddAddressFrame, error)
func (*AddAddressFrame) MinLength ¶
func (f *AddAddressFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
func (*AddAddressFrame) Write ¶
func (f *AddAddressFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
type BlockedFrame ¶
A BlockedFrame in QUIC
func ParseBlockedFrame ¶
func ParseBlockedFrame(r *bytes.Reader, version protocol.VersionNumber) (*BlockedFrame, error)
ParseBlockedFrame parses a BLOCKED frame
func (*BlockedFrame) MinLength ¶
func (f *BlockedFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
MinLength of a written frame
func (*BlockedFrame) Write ¶
func (f *BlockedFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
Write writes a BlockedFrame frame
type ClosePathFrame ¶
type ClosePathFrame struct { PathID protocol.PathID LargestAcked protocol.PacketNumber LowestAcked protocol.PacketNumber AckRanges []AckRange // has to be ordered. The ACK range with the highest First goes first, the ACK range with the lowest First goes last }
A ClosePathFrame in (IETF) QUIC
func ParseClosePathFrame ¶
func ParseClosePathFrame(r *bytes.Reader, version protocol.VersionNumber) (*ClosePathFrame, error)
func (*ClosePathFrame) AcksPacket ¶
func (f *ClosePathFrame) AcksPacket(p protocol.PacketNumber) bool
AcksPacket determines if this ClosePath frame acks a certain packet number
func (*ClosePathFrame) HasMissingRanges ¶
func (f *ClosePathFrame) HasMissingRanges() bool
func (*ClosePathFrame) MinLength ¶
func (f *ClosePathFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
func (*ClosePathFrame) Write ¶
func (f *ClosePathFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
type ConnectionCloseFrame ¶
A ConnectionCloseFrame in QUIC
func ParseConnectionCloseFrame ¶
func ParseConnectionCloseFrame(r *bytes.Reader, version protocol.VersionNumber) (*ConnectionCloseFrame, error)
ParseConnectionCloseFrame reads a CONNECTION_CLOSE frame
func (*ConnectionCloseFrame) MinLength ¶
func (f *ConnectionCloseFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
MinLength of a written frame
func (*ConnectionCloseFrame) Write ¶
func (f *ConnectionCloseFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
Write writes an CONNECTION_CLOSE frame.
type Frame ¶
type Frame interface { Write(b *bytes.Buffer, version protocol.VersionNumber) error MinLength(version protocol.VersionNumber) (protocol.ByteCount, error) }
A Frame in QUIC
type GoawayFrame ¶
type GoawayFrame struct { ErrorCode qerr.ErrorCode LastGoodStream protocol.StreamID ReasonPhrase string }
A GoawayFrame is a GOAWAY frame
func ParseGoawayFrame ¶
func ParseGoawayFrame(r *bytes.Reader, version protocol.VersionNumber) (*GoawayFrame, error)
ParseGoawayFrame parses a GOAWAY frame
func (*GoawayFrame) MinLength ¶
func (f *GoawayFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
MinLength of a written frame
func (*GoawayFrame) Write ¶
func (f *GoawayFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
type PathsFrame ¶
type PathsFrame struct { MaxNumPaths uint8 NumPaths uint8 PathIDs []protocol.PathID RemoteRTTs []time.Duration }
A PathsFrame in QUIC
func ParsePathsFrame ¶
func ParsePathsFrame(r *bytes.Reader, version protocol.VersionNumber) (*PathsFrame, error)
func (*PathsFrame) MinLength ¶
func (f *PathsFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
func (*PathsFrame) Write ¶
func (f *PathsFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
type PingFrame ¶
type PingFrame struct{}
A PingFrame is a ping frame
func ParsePingFrame ¶
ParsePingFrame parses a Ping frame
type PublicHeader ¶
type PublicHeader struct { Raw []byte ConnectionID protocol.ConnectionID PathID protocol.PathID VersionFlag bool ResetFlag bool TruncateConnectionID bool MultipathFlag bool PacketNumberLen protocol.PacketNumberLen PacketNumber protocol.PacketNumber VersionNumber protocol.VersionNumber // VersionNumber sent by the client SupportedVersions []protocol.VersionNumber // VersionNumbers sent by the server DiversificationNonce []byte }
The PublicHeader of a QUIC packet. Warning: This struct should not be considered stable and will change soon.
func ParsePublicHeader ¶
func ParsePublicHeader(b *bytes.Reader, packetSentBy protocol.Perspective, version protocol.VersionNumber) (*PublicHeader, error)
ParsePublicHeader parses a QUIC packet's public header. The packetSentBy is the perspective of the peer that sent this PublicHeader, i.e. if we're the server, packetSentBy should be PerspectiveClient. Warning: This API should not be considered stable and will change soon.
func (*PublicHeader) GetLength ¶
func (h *PublicHeader) GetLength(pers protocol.Perspective) (protocol.ByteCount, error)
GetLength gets the length of the publicHeader in bytes. It can only be called for regular packets.
func (*PublicHeader) Write ¶
func (h *PublicHeader) Write(b *bytes.Buffer, version protocol.VersionNumber, pers protocol.Perspective) error
Write writes a public header. Warning: This API should not be considered stable and will change soon.
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 ErrorCode uint32 ByteOffset protocol.ByteCount }
A RstStreamFrame in QUIC
func ParseRstStreamFrame ¶
func ParseRstStreamFrame(r *bytes.Reader, version protocol.VersionNumber) (*RstStreamFrame, error)
ParseRstStreamFrame parses a RST_STREAM frame
func (*RstStreamFrame) MinLength ¶
func (f *RstStreamFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
MinLength 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 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 ParseStopWaitingFrame ¶
func ParseStopWaitingFrame(r *bytes.Reader, packetNumber protocol.PacketNumber, packetNumberLen protocol.PacketNumberLen, version protocol.VersionNumber) (*StopWaitingFrame, error)
ParseStopWaitingFrame parses a StopWaiting frame
func (*StopWaitingFrame) MinLength ¶
func (f *StopWaitingFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
MinLength of a written frame
func (*StopWaitingFrame) Write ¶
func (f *StopWaitingFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
type StreamFrame ¶
type StreamFrame struct { StreamID protocol.StreamID FinBit bool DataLenPresent bool Offset protocol.ByteCount Data []byte }
A StreamFrame of QUIC
func ParseStreamFrame ¶
func ParseStreamFrame(r *bytes.Reader, version protocol.VersionNumber) (*StreamFrame, error)
ParseStreamFrame reads a stream frame. The type byte must not have been read yet.
func (*StreamFrame) DataLen ¶
func (f *StreamFrame) DataLen() protocol.ByteCount
DataLen gives the length of data in bytes
func (*StreamFrame) MinLength ¶
func (f *StreamFrame) MinLength(protocol.VersionNumber) (protocol.ByteCount, error)
MinLength returns the length of the header of a StreamFrame the total length of the StreamFrame is frame.MinLength() + frame.DataLen()
func (*StreamFrame) Write ¶
func (f *StreamFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
WriteStreamFrame writes a stream frame.
type WindowUpdateFrame ¶
A WindowUpdateFrame in QUIC
func ParseWindowUpdateFrame ¶
func ParseWindowUpdateFrame(r *bytes.Reader, version protocol.VersionNumber) (*WindowUpdateFrame, error)
ParseWindowUpdateFrame parses a RST_STREAM frame
func (*WindowUpdateFrame) MinLength ¶
func (f *WindowUpdateFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error)
MinLength of a written frame
func (*WindowUpdateFrame) Write ¶
func (f *WindowUpdateFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
Write writes a RST_STREAM frame
Source Files ¶
- ack_frame.go
- ack_range.go
- add_address_frame.go
- blocked_frame.go
- close_path_frame.go
- connection_close_frame.go
- frame.go
- goaway_frame.go
- log.go
- paths_frame.go
- ping_frame.go
- public_header.go
- public_reset.go
- rst_stream_frame.go
- stop_waiting_frame.go
- stream_frame.go
- version_negotiation.go
- window_update_frame.go