quictracker

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

README

QUIC Adapter

This is an Abstract Symbols <-> Concrete Symbol adapter for the QUIC protocol based on quic-tracker.

Interesting Components:
  • adapter/adapter.go -> The main interface for the learner, start point for requests.
  • adapter/abstract.go -> Implementation of abstract alphabet.
  • adapter/concrete.go -> Implementation of concrete alphabet.
  • agents/ -> Collection of agents responsible for each aspect of the protocol.
  • connection.go -> Main protocol state.

Documentation

Overview

QUIC-Tracker is a test suite for QUIC, built upon a minimal client implementation in Go. It is currently draft-27 and TLS-1.3 compatible.

The main package is a toolbox to parse and create QUIC packets of all types. More high-level client behaviours are implemented in the package agents. Several test scenarii are implemented in the package scenarii.

Architecture

QUIC-Tracker is comprised of three parts.

The first is this package, which contains types, methods and functions to parse and create QUIC packets that can be easily manipulated.

The second is the package agents, which implements all the features and behaviours of a QUIC client as asynchronous message-passing objects. These agents exchange messages through the broadcasting channels defined in the Connection struct. This allows additional behaviours to be hooked up and respond to several events that occur when the connection is active.

The third the package scenarii, which contains all the tests of the test suite. They can be ran using the scripts in the package bin/test_suite. The tests results are produced in an unified JSON format. It is described in the Trace type documentation.

QUIC-Tracker is licensed under the GNU Affero General Public License version 3. You can find its terms in the LICENSE file, or at https://www.gnu.org/licenses/agpl.txt.

Copyright (C) 2017-2020 Maxime Piraux

Index

Constants

View Source
const (
	MinimumInitialLength       = 1252
	MinimumInitialLengthv6     = 1232
	MaxTheoreticUDPPayloadSize = 65507
	MaximumVersion             = 0xff00001c
	MinimumVersion             = 0xff00001c
)
View Source
const (
	ERR_STREAM_LIMIT_ERROR = 0x04
	ERR_STREAM_STATE_ERROR = 0x05
	ERR_PROTOCOL_VIOLATION = 0x0a
)
View Source
const (
	ECNStatusNonECT ECNStatus = 0
	ECNStatusECT_1            = 1
	ECNStatusECT_0            = 2
	ECNStatusCE               = 3
)
View Source
const (
	PaddingFrameType       FrameType = 0x00
	PingType                         = 0x01
	AckType                          = 0x02
	AckECNType                       = 0x03
	ResetStreamType                  = 0x04
	StopSendingType                  = 0x05
	CryptoType                       = 0x06
	NewTokenType                     = 0x07
	StreamType                       = 0x08
	MaxDataType                      = 0x10
	MaxStreamDataType                = 0x11
	MaxStreamsType                   = 0x12
	DataBlockedType                  = 0x14
	StreamDataBlockedType            = 0x15
	StreamsBlockedType               = 0x16
	NewConnectionIdType              = 0x18
	RetireConnectionIdType           = 0x19
	PathChallengeType                = 0x1a
	PathResponseType                 = 0x1b
	ConnectionCloseType              = 0x1c
	ApplicationCloseType             = 0x1d
	HandshakeDoneType                = 0x1e
)
View Source
const (
	OriginalDestinationConnectionId TransportParametersType = 0x00
	IdleTimeout                                             = 0x01
	StatelessResetToken                                     = 0x02
	MaxUDPPacketSize                                        = 0x03
	InitialMaxData                                          = 0x04
	InitialMaxStreamDataBidiLocal                           = 0x05
	InitialMaxStreamDataBidiRemote                          = 0x06
	InitialMaxStreamDataUni                                 = 0x07
	InitialMaxStreamsBidi                                   = 0x08
	InitialMaxStreamsUni                                    = 0x09
	AckDelayExponent                                        = 0x0a
	MaxAckDelay                                             = 0x0b
	DisableMigration                                        = 0x0c
	PreferredAddress                                        = 0x0d // TODO: Handle this parameter
	ActiveConnectionIdLimit                                 = 0x0e
	InitialSourceConnectionId                               = 0x0f
	RetrySourceConnectionId                                 = 0x10
)

Variables

View Source
var JSONTypeHandlers = map[JSONType]func() interface{}{
	InitialPacketJSON:            func() interface{} { type local InitialPacket; return new(local) },
	RetryPacketJSON:              func() interface{} { type local RetryPacket; return new(local) },
	StatelessResetPacketJSON:     func() interface{} { type local StatelessResetPacket; return new(local) },
	VersionNegotiationPacketJSON: func() interface{} { type local VersionNegotiationPacket; return new(local) },
	HandshakePacketJSON:          func() interface{} { type local HandshakePacket; return new(local) },
	ProtectedPacketJSON:          func() interface{} { type local ProtectedPacket; return new(local) },
	ZeroRTTProtectedPacketJSON:   func() interface{} { type local ZeroRTTProtectedPacket; return new(local) },

	ShortHeaderJSON: func() interface{} { type local ShortHeader; return new(local) },
	LongHeaderJSON:  func() interface{} { type local LongHeader; return new(local) },

	PaddingFrameJSON:           func() interface{} { type local PaddingFrame; return new(local) },
	PingFrameJSON:              func() interface{} { type local PingFrame; return new(local) },
	AckFrameJSON:               func() interface{} { type local AckFrame; return new(local) },
	AckECNFrameJSON:            func() interface{} { type local AckECNFrame; return new(local) },
	ResetStreamJSON:            func() interface{} { type local ResetStream; return new(local) },
	StopSendingFrameJSON:       func() interface{} { type local StopSendingFrame; return new(local) },
	CryptoFrameJSON:            func() interface{} { type local CryptoFrame; return new(local) },
	NewTokenFrameJSON:          func() interface{} { type local NewTokenFrame; return new(local) },
	StreamFrameJSON:            func() interface{} { type local StreamFrame; return new(local) },
	MaxDataFrameJSON:           func() interface{} { type local MaxDataFrame; return new(local) },
	MaxStreamsFrameJSON:        func() interface{} { type local MaxStreamsFrame; return new(local) },
	MaxStreamDataFrameJSON:     func() interface{} { type local MaxStreamDataFrame; return new(local) },
	DataBlockedFrameJSON:       func() interface{} { type local DataBlockedFrame; return new(local) },
	StreamDataBlockedFrameJSON: func() interface{} { type local StreamDataBlockedFrame; return new(local) },
	StreamsBlockedFrameJSON:    func() interface{} { type local StreamsBlockedFrame; return new(local) },
	NewConnectionIdFrameJSON:   func() interface{} { type local NewConnectionIdFrame; return new(local) },
	RetireConnectionIdJSON:     func() interface{} { type local RetireConnectionId; return new(local) },
	PathChallengeJSON:          func() interface{} { type local PathChallenge; return new(local) },
	PathResponseJSON:           func() interface{} { type local PathResponse; return new(local) },
	ConnectionCloseFrameJSON:   func() interface{} { type local ConnectionCloseFrame; return new(local) },
	ApplicationCloseFrameJSON:  func() interface{} { type local ApplicationCloseFrame; return new(local) },
	HandshakeDoneFrameJSON:     func() interface{} { type local HandshakeDoneFrame; return new(local) },
}
View Source
var PNSpaceToEncryptionLevel = map[PNSpace]EncryptionLevel{
	PNSpaceNoSpace:   EncryptionLevelNone,
	PNSpaceInitial:   EncryptionLevelInitial,
	PNSpaceHandshake: EncryptionLevelHandshake,
	PNSpaceAppData:   EncryptionLevel1RTT,
}
View Source
var PNSpaceToString = map[PNSpace]string{
	PNSpaceInitial:   "Initial",
	PNSpaceHandshake: "Handshake",
	PNSpaceAppData:   "Application data",
}
View Source
var PacketTypeToEncryptionLevel = map[PacketType]EncryptionLevel{
	VersionNegotiation: EncryptionLevelNone,
	Initial:            EncryptionLevelInitial,
	Retry:              EncryptionLevelNone,
	Handshake:          EncryptionLevelHandshake,
	ZeroRTTProtected:   EncryptionLevel0RTT,
	ShortHeaderPacket:  EncryptionLevel1RTT,
}
View Source
var PacketTypeToPNSpace = map[PacketType]PNSpace{
	Initial:           PNSpaceInitial,
	Handshake:         PNSpaceHandshake,
	ShortHeaderPacket: PNSpaceAppData,
}

TODO: Reconsider the use of global variables

Functions

func EstablishUDPConnection

func EstablishUDPConnection(addr *net.UDPAddr, localAddress *net.UDPAddr) (*net.UDPConn, error)

func GetMaxBidiClient

func GetMaxBidiClient(limit uint64) uint64

func GetMaxBidiServer

func GetMaxBidiServer(limit uint64) uint64

func GetMaxUniClient

func GetMaxUniClient(limit uint64) uint64

func GetMaxUniServer

func GetMaxUniServer(limit uint64) uint64

func GetPacketSample

func GetPacketSample(header Header, packetBytes []byte) ([]byte, int)

func GitCommit

func GitCommit() string

func IsBidi

func IsBidi(streamId uint64) bool

func IsBidiClient

func IsBidiClient(streamId uint64) bool

func IsBidiServer

func IsBidiServer(streamId uint64) bool

func IsClient

func IsClient(streamId uint64) bool

func IsServer

func IsServer(streamId uint64) bool

func IsUni

func IsUni(streamId uint64) bool

func IsUniClient

func IsUniClient(streamId uint64) bool

func IsUniServer

func IsUniServer(streamId uint64) bool

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func NewbyteIntervalList

func NewbyteIntervalList() *byteIntervalList

NewbyteIntervalList returns an initialized list.

func StartPcapCapture

func StartPcapCapture(conn *Connection, netInterface string) (*exec.Cmd, error)

func StopPcapCapture

func StopPcapCapture(conn *Connection, cmd *exec.Cmd) ([]byte, error)

func Uint16ToBEBytes

func Uint16ToBEBytes(uint16 uint16) []byte

func Uint24ToBEBytes

func Uint24ToBEBytes(uint32 uint32) []byte

func Uint32ToBEBytes

func Uint32ToBEBytes(uint32 uint32) []byte

Types

type AbstractPacket

type AbstractPacket struct {
	Header Header
	// contains filtered or unexported fields
}

func (AbstractPacket) Encode

func (p AbstractPacket) Encode(payload []byte) []byte

func (AbstractPacket) EncodeHeader

func (p AbstractPacket) EncodeHeader() []byte

func (AbstractPacket) GetHeader

func (p AbstractPacket) GetHeader() Header

func (AbstractPacket) ReceiveContext

func (p AbstractPacket) ReceiveContext() PacketContext

func (AbstractPacket) SendContext

func (p AbstractPacket) SendContext() PacketContext

func (*AbstractPacket) SetReceiveContext

func (p *AbstractPacket) SetReceiveContext(ctx PacketContext)

func (*AbstractPacket) SetSendContext

func (p *AbstractPacket) SetSendContext(ctx PacketContext)

func (AbstractPacket) ShortString

func (p AbstractPacket) ShortString() string

type AckECNFrame

type AckECNFrame struct {
	AckFrame
	ECT0Count  uint64
	ECT1Count  uint64
	ECTCECount uint64
}

func ReadAckECNFrame

func ReadAckECNFrame(buffer *bytes.Reader, conn *Connection) *AckECNFrame

func (*AckECNFrame) FrameLength

func (frame *AckECNFrame) FrameLength() uint16

func (*AckECNFrame) FrameType

func (frame *AckECNFrame) FrameType() FrameType

func (AckECNFrame) MarshalJSON added in v1.0.0

func (frame AckECNFrame) MarshalJSON() ([]byte, error)

func (*AckECNFrame) WriteTo

func (frame *AckECNFrame) WriteTo(buffer *bytes.Buffer)

type AckFrame

type AckFrame struct {
	LargestAcknowledged PacketNumber
	AckDelay            uint64
	AckRangeCount       uint64
	AckRanges           []AckRange
}

func ReadAckFrame

func ReadAckFrame(buffer *bytes.Reader) *AckFrame

func (AckFrame) Equal

func (frame AckFrame) Equal(otherFrame AckFrame) bool

func (*AckFrame) FrameLength

func (frame *AckFrame) FrameLength() uint16

func (*AckFrame) FrameType

func (frame *AckFrame) FrameType() FrameType

func (*AckFrame) GetAckedPackets

func (frame *AckFrame) GetAckedPackets() []PacketNumber

func (AckFrame) MarshalJSON added in v1.0.0

func (frame AckFrame) MarshalJSON() ([]byte, error)

func (*AckFrame) WriteTo

func (frame *AckFrame) WriteTo(buffer *bytes.Buffer)

type AckRange

type AckRange struct {
	Gap      uint64
	AckRange uint64
}

type ApplicationCloseFrame

type ApplicationCloseFrame struct {
	// TODO: Merge it with 0x1c
	ErrorCode          uint64
	ReasonPhraseLength uint64
	ReasonPhrase       string
}

func NewApplicationCloseFrame

func NewApplicationCloseFrame(buffer *bytes.Reader) *ApplicationCloseFrame

func (*ApplicationCloseFrame) FrameLength

func (frame *ApplicationCloseFrame) FrameLength() uint16

func (*ApplicationCloseFrame) FrameType

func (frame *ApplicationCloseFrame) FrameType() FrameType

func (ApplicationCloseFrame) MarshalJSON added in v1.0.0

func (frame ApplicationCloseFrame) MarshalJSON() ([]byte, error)

func (*ApplicationCloseFrame) WriteTo

func (frame *ApplicationCloseFrame) WriteTo(buffer *bytes.Buffer)

type Broadcaster

type Broadcaster struct {
	broadcast.Broadcaster
	// contains filtered or unexported fields
}

func NewBroadcaster

func NewBroadcaster(buflen int) Broadcaster

func (*Broadcaster) Close

func (b *Broadcaster) Close() error

func (*Broadcaster) RegisterNewChan

func (b *Broadcaster) RegisterNewChan(size int) chan interface{}

type Connection

type Connection struct {
	ServerName    string
	UdpConnection *net.UDPConn
	UseIPv6       bool
	Host          *net.UDPAddr
	InterfaceMTU  int

	Tls          *pigotls.Connection
	TLSTPHandler *TLSTransportParameterHandler

	KeyPhaseIndex  uint
	SpinBit        SpinBit
	LastSpinNumber PacketNumber

	CryptoStateLock sync.Locker
	CryptoStates    map[EncryptionLevel]*CryptoState

	ReceivedPacketHandler func([]byte, unsafe.Pointer)
	SentPacketHandler     func([]byte, unsafe.Pointer)

	CryptoStreams   CryptoStreams // TODO: It should be a parent class without closing states
	Streams         Streams
	CurrentStreamID uint64

	IncomingPackets     Broadcaster //type: Packet
	OutgoingPackets     Broadcaster //type: Packet
	IncomingPayloads    Broadcaster //type: IncomingPayload
	UnprocessedPayloads Broadcaster //type: UnprocessedPayload
	EncryptionLevels    Broadcaster //type: DirectionalEncryptionLevel
	FrameQueue          Broadcaster //type: QueuedFrame
	TransportParameters Broadcaster //type: QuicTransportParameters

	PreparePacket      Broadcaster //type: EncryptionLevel
	SendPacket         Broadcaster //type: PacketToSend
	StreamInput        Broadcaster //type: StreamInput
	PacketAcknowledged Broadcaster //type: PacketAcknowledged

	ConnectionClosed    chan bool
	ConnectionRestart   chan bool // Triggered when receiving a Retry or a VN packet
	ConnectionRestarted chan bool

	OriginalDestinationCID ConnectionID
	SourceCID              ConnectionID
	DestinationCID         ConnectionID
	Version                uint32
	ALPN                   string

	Token            []byte
	ResumptionTicket []byte

	PacketNumberLock       sync.Locker
	PacketNumber           map[PNSpace]PacketNumber // Stores the next PN to be sent
	LargestPNsReceived     map[PNSpace]PacketNumber // Stores the largest PN received
	LargestPNsAcknowledged map[PNSpace]PacketNumber // Stores the largest PN we have sent that were acknowledged by the peer

	MinRTT      uint64
	SmoothedRTT uint64
	RTTVar      uint64

	AckQueue           map[PNSpace][]PacketNumber        // Stores the packet numbers to be acked TODO: This should be a channel actually
	TlsQueue           map[EncryptionLevel][]QueuedFrame // Stores TLS QueuedFrames that are to be sent when requested.
	FlowControlQueue   map[FrameRequest][]QueuedFrame    // Stores Flow Control QueuedFrames that are to be sent when requested.
	StreamQueue        map[FrameRequest][]QueuedFrame    // Stores Stream QueuedFrames that are to be sent when requested.
	ReceiveFrameBuffer map[PNSpace]map[FrameType][]Frame // Keeps track of received frames to detect retransmits.
	Logger             *log.Logger
	QLog               qlog.QLog
	QLogTrace          *qlog.Trace
	QLogEvents         chan *qlog.Event
}

func NewConnection

func NewConnection(serverName string, version uint32, ALPN string, SCID []byte, DCID []byte, udpConn *net.UDPConn, resumptionTicket []byte) *Connection

func NewDefaultConnection

func NewDefaultConnection(address string, serverName string, resumptionTicket []byte, useIPv6 bool, preferredALPN string, negotiateHTTP3 bool) (*Connection, error)

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) CloseConnection

func (c *Connection) CloseConnection(quicLayer bool, errCode uint64, reasonPhrase string)

func (*Connection) ConnectedIp

func (c *Connection) ConnectedIp() net.Addr

func (*Connection) CryptoState

func (c *Connection) CryptoState(level EncryptionLevel) *CryptoState

func (*Connection) DoSendPacket

func (c *Connection) DoSendPacket(packet Packet, level EncryptionLevel)

func (*Connection) EncodeAndEncrypt

func (c *Connection) EncodeAndEncrypt(packet Packet, level EncryptionLevel) []byte

func (*Connection) GetAckFrame

func (c *Connection) GetAckFrame(space PNSpace) *AckFrame

func (*Connection) GetCryptoFrame

func (c *Connection) GetCryptoFrame(encLevel EncryptionLevel) *CryptoFrame

func (*Connection) GetInitialPacket

func (c *Connection) GetInitialPacket() *InitialPacket

func (*Connection) PacketWasSent

func (c *Connection) PacketWasSent(packet Packet)

func (*Connection) ProcessVersionNegotation

func (c *Connection) ProcessVersionNegotation(vn *VersionNegotiationPacket) error

func (*Connection) SendHTTP09GETRequest

func (c *Connection) SendHTTP09GETRequest(path string, streamID uint64)

func (*Connection) TransitionTo

func (c *Connection) TransitionTo(version uint32, ALPN string)

type ConnectionCloseFrame

type ConnectionCloseFrame struct {
	ErrorCode          uint64
	ErrorFrameType     uint64
	ReasonPhraseLength uint64
	ReasonPhrase       string
}

func NewConnectionCloseFrame

func NewConnectionCloseFrame(buffer *bytes.Reader) *ConnectionCloseFrame

func (*ConnectionCloseFrame) FrameLength

func (frame *ConnectionCloseFrame) FrameLength() uint16

func (*ConnectionCloseFrame) FrameType

func (frame *ConnectionCloseFrame) FrameType() FrameType

func (ConnectionCloseFrame) MarshalJSON added in v1.0.0

func (frame ConnectionCloseFrame) MarshalJSON() ([]byte, error)

func (*ConnectionCloseFrame) WriteTo

func (frame *ConnectionCloseFrame) WriteTo(buffer *bytes.Buffer)

type ConnectionID

type ConnectionID []byte

func (ConnectionID) CIDL

func (c ConnectionID) CIDL() uint8

func (ConnectionID) String

func (c ConnectionID) String() string

func (ConnectionID) WriteTo

func (c ConnectionID) WriteTo(buffer *bytes.Buffer)

type CryptoFrame

type CryptoFrame struct {
	Offset     uint64
	Length     uint64
	CryptoData []byte
}

func NewCryptoFrame

func NewCryptoFrame(cryptoStream *Stream, data []byte) *CryptoFrame

func ReadCryptoFrame

func ReadCryptoFrame(buffer *bytes.Reader, conn *Connection) *CryptoFrame

func (*CryptoFrame) FrameLength

func (frame *CryptoFrame) FrameLength() uint16

func (*CryptoFrame) FrameType

func (frame *CryptoFrame) FrameType() FrameType

func (CryptoFrame) MarshalJSON added in v1.0.0

func (frame CryptoFrame) MarshalJSON() ([]byte, error)

func (*CryptoFrame) WriteTo

func (frame *CryptoFrame) WriteTo(buffer *bytes.Buffer)

type CryptoState

type CryptoState struct {
	Read        *pigotls.AEAD
	Write       *pigotls.AEAD
	HeaderRead  *pigotls.Cipher
	HeaderWrite *pigotls.Cipher
}

func NewInitialPacketProtection

func NewInitialPacketProtection(conn *Connection) *CryptoState

func NewProtectedCryptoState

func NewProtectedCryptoState(tls *pigotls.Connection, readSecret []byte, writeSecret []byte) *CryptoState

func (*CryptoState) InitRead

func (s *CryptoState) InitRead(tls *pigotls.Connection, readSecret []byte)

func (*CryptoState) InitWrite

func (s *CryptoState) InitWrite(tls *pigotls.Connection, writeSecret []byte)

type CryptoStreams

type CryptoStreams map[PNSpace]*Stream

func (CryptoStreams) Get

func (s CryptoStreams) Get(space PNSpace) *Stream

type DataBlockedFrame

type DataBlockedFrame struct {
	DataLimit uint64
}

func NewBlockedFrame

func NewBlockedFrame(buffer *bytes.Reader) *DataBlockedFrame

func (*DataBlockedFrame) FrameLength

func (frame *DataBlockedFrame) FrameLength() uint16

func (*DataBlockedFrame) FrameType

func (frame *DataBlockedFrame) FrameType() FrameType

func (DataBlockedFrame) MarshalJSON added in v1.0.0

func (frame DataBlockedFrame) MarshalJSON() ([]byte, error)

func (*DataBlockedFrame) WriteTo

func (frame *DataBlockedFrame) WriteTo(buffer *bytes.Buffer)

type Direction

type Direction string
const ToClient Direction = "to_client"
const ToServer Direction = "to_server"

type DirectionalEncryptionLevel

type DirectionalEncryptionLevel struct {
	EncryptionLevel EncryptionLevel
	Read            bool
	Available       bool
}

type ECNStatus

type ECNStatus int

type EncryptedExtensionsTransportParameters

type EncryptedExtensionsTransportParameters struct {
	TransportParameterList `tls:"head=2"`
}

type EncryptionLevel

type EncryptionLevel int
const (
	EncryptionLevelNone EncryptionLevel = iota
	EncryptionLevelInitial
	EncryptionLevel0RTT
	EncryptionLevelHandshake
	EncryptionLevel1RTT
	EncryptionLevelBest        // A special flag to indicate that the best encryption level available should be used
	EncryptionLevelBestAppData // A special flag to indicate that the best app data encryption level available should be used
)

func (EncryptionLevel) String

func (eL EncryptionLevel) String() string

type Envelope added in v1.0.0

type Envelope struct {
	Type    JSONType
	Message interface{}
}

type Frame

type Frame interface {
	FrameType() FrameType
	WriteTo(buffer *bytes.Buffer)

	FrameLength() uint16
	MarshalJSON() ([]byte, error)
	// contains filtered or unexported methods
}

func NewFrame

func NewFrame(buffer *bytes.Reader, conn *Connection) (Frame, error)

func NewFrameFromType

func NewFrameFromType(frameType FrameType, buffer *bytes.Reader, conn *Connection) (Frame, error)

type FramePacket

type FramePacket struct {
	AbstractPacket
	Frames []Frame
}

func (*FramePacket) AddFrame

func (p *FramePacket) AddFrame(frame Frame)

func (*FramePacket) Contains

func (p *FramePacket) Contains(frameType FrameType) bool

func (*FramePacket) EncodePayload

func (p *FramePacket) EncodePayload() []byte

func (*FramePacket) GetAll

func (p *FramePacket) GetAll(frameType FrameType) []Frame

func (*FramePacket) GetFirst

func (p *FramePacket) GetFirst(frameType FrameType) Frame

func (*FramePacket) GetFrames

func (p *FramePacket) GetFrames() []Frame

func (*FramePacket) GetRetransmittableFrames

func (p *FramePacket) GetRetransmittableFrames() []Frame

func (*FramePacket) OnlyContains

func (p *FramePacket) OnlyContains(frameType FrameType) bool

func (*FramePacket) PadTo

func (p *FramePacket) PadTo(length int)

func (*FramePacket) Pointer

func (p *FramePacket) Pointer() unsafe.Pointer

func (*FramePacket) RemoveAtIndex

func (p *FramePacket) RemoveAtIndex(index int)

func (*FramePacket) ShouldBeAcknowledged

func (p *FramePacket) ShouldBeAcknowledged() bool

type FrameRequest

type FrameRequest struct {
	FrameType
	EncryptionLevel
}

type FrameType

type FrameType uint64

func FrameTypeFromString

func FrameTypeFromString(input string) FrameType

func (FrameType) String

func (t FrameType) String() string

type Framer

type Framer interface {
	Packet
	GetFrames() []Frame
	AddFrame(frame Frame)
	RemoveAtIndex(index int)
	GetRetransmittableFrames() []Frame
	Contains(frameType FrameType) bool
	OnlyContains(frameType FrameType) bool
	GetFirst(frameType FrameType) Frame
	GetAll(frameType FrameType) []Frame
	PadTo(length int)
}

type HandshakeDoneFrame

type HandshakeDoneFrame byte

func NewHandshakeDoneFrame

func NewHandshakeDoneFrame(buffer *bytes.Reader) *HandshakeDoneFrame

func (*HandshakeDoneFrame) FrameLength

func (frame *HandshakeDoneFrame) FrameLength() uint16

func (*HandshakeDoneFrame) FrameType

func (frame *HandshakeDoneFrame) FrameType() FrameType

func (HandshakeDoneFrame) MarshalJSON added in v1.0.0

func (frame HandshakeDoneFrame) MarshalJSON() ([]byte, error)

func (*HandshakeDoneFrame) WriteTo

func (frame *HandshakeDoneFrame) WriteTo(buffer *bytes.Buffer)

type HandshakePacket

type HandshakePacket struct {
	FramePacket
}

func NewHandshakePacket

func NewHandshakePacket(conn *Connection) *HandshakePacket

func ReadHandshakePacket

func ReadHandshakePacket(buffer *bytes.Reader, conn *Connection) *HandshakePacket

func (*HandshakePacket) EncryptionLevel

func (p *HandshakePacket) EncryptionLevel() EncryptionLevel

func (HandshakePacket) MarshalJSON added in v1.0.0

func (p HandshakePacket) MarshalJSON() ([]byte, error)

func (*HandshakePacket) PNSpace

func (p *HandshakePacket) PNSpace() PNSpace
type Header interface {
	GetPacketType() PacketType
	DestinationConnectionID() ConnectionID
	GetPacketNumber() PacketNumber
	SetPacketNumber(number PacketNumber)
	GetTruncatedPN() TruncatedPN
	EncryptionLevel() EncryptionLevel
	Encode() []byte
	HeaderLength() int
	MarshalJSON() ([]byte, error)
}

func ReadHeader

func ReadHeader(buffer *bytes.Reader, conn *Connection) Header

type IncomingPayload

type IncomingPayload struct {
	PacketContext
	Payload []byte
}

type InitialPacket

type InitialPacket struct {
	FramePacket
}

func NewInitialPacket

func NewInitialPacket(conn *Connection) *InitialPacket

func ReadInitialPacket

func ReadInitialPacket(buffer *bytes.Reader, conn *Connection) *InitialPacket

func (*InitialPacket) EncryptionLevel

func (p *InitialPacket) EncryptionLevel() EncryptionLevel

func (*InitialPacket) GetRetransmittableFrames

func (p *InitialPacket) GetRetransmittableFrames() []Frame

func (InitialPacket) MarshalJSON added in v1.0.0

func (p InitialPacket) MarshalJSON() ([]byte, error)

func (*InitialPacket) PNSpace

func (p *InitialPacket) PNSpace() PNSpace

type JSONType added in v1.0.0

type JSONType int
const (
	InitialPacketJSON JSONType = iota
	RetryPacketJSON
	StatelessResetPacketJSON
	VersionNegotiationPacketJSON
	HandshakePacketJSON
	ProtectedPacketJSON
	ZeroRTTProtectedPacketJSON

	ShortHeaderJSON
	LongHeaderJSON

	PaddingFrameJSON
	PingFrameJSON
	AckFrameJSON
	AckECNFrameJSON
	ResetStreamJSON
	StopSendingFrameJSON
	CryptoFrameJSON
	NewTokenFrameJSON
	StreamFrameJSON
	MaxDataFrameJSON
	MaxStreamsFrameJSON
	MaxStreamDataFrameJSON
	DataBlockedFrameJSON
	StreamDataBlockedFrameJSON
	StreamsBlockedFrameJSON
	NewConnectionIdFrameJSON
	RetireConnectionIdJSON
	PathChallengeJSON
	PathResponseJSON
	ConnectionCloseFrameJSON
	ApplicationCloseFrameJSON
	HandshakeDoneFrameJSON
)

func (JSONType) MarshalJSON added in v1.0.0

func (r JSONType) MarshalJSON() ([]byte, error)

MarshalJSON is generated so JSONType satisfies json.Marshaler.

func (*JSONType) UnmarshalJSON added in v1.0.0

func (r *JSONType) UnmarshalJSON(data []byte) error

UnmarshalJSON is generated so JSONType satisfies json.Unmarshaler.

type KeyPhaseBit

type KeyPhaseBit bool
const KeyPhaseOne KeyPhaseBit = true
const KeyPhaseZero KeyPhaseBit = false

type LongHeader

type LongHeader struct {
	PacketType     PacketType
	LowerBits      byte
	Version        uint32
	DestinationCID ConnectionID
	SourceCID      ConnectionID
	TokenLength    VarInt
	Token          []byte
	Length         VarInt
	PacketNumber   PacketNumber
	TruncatedPN    TruncatedPN
}

func NewLongHeader

func NewLongHeader(packetType PacketType, conn *Connection, space PNSpace) *LongHeader

func ReadLongHeader

func ReadLongHeader(buffer *bytes.Reader, conn *Connection) *LongHeader

func (*LongHeader) DestinationConnectionID

func (h *LongHeader) DestinationConnectionID() ConnectionID

func (*LongHeader) Encode

func (h *LongHeader) Encode() []byte

func (*LongHeader) EncryptionLevel

func (h *LongHeader) EncryptionLevel() EncryptionLevel

func (*LongHeader) GetPacketNumber

func (h *LongHeader) GetPacketNumber() PacketNumber

func (*LongHeader) GetPacketType

func (h *LongHeader) GetPacketType() PacketType

func (*LongHeader) GetTruncatedPN

func (h *LongHeader) GetTruncatedPN() TruncatedPN

func (*LongHeader) HeaderLength

func (h *LongHeader) HeaderLength() int

func (LongHeader) MarshalJSON added in v1.0.0

func (h LongHeader) MarshalJSON() ([]byte, error)

func (*LongHeader) SetPacketNumber added in v1.0.0

func (h *LongHeader) SetPacketNumber(number PacketNumber)

type MaxDataFrame

type MaxDataFrame struct {
	MaximumData uint64
}

func NewMaxDataFrame

func NewMaxDataFrame(buffer *bytes.Reader) *MaxDataFrame

func (*MaxDataFrame) FrameLength

func (frame *MaxDataFrame) FrameLength() uint16

func (*MaxDataFrame) FrameType

func (frame *MaxDataFrame) FrameType() FrameType

func (MaxDataFrame) MarshalJSON added in v1.0.0

func (frame MaxDataFrame) MarshalJSON() ([]byte, error)

func (*MaxDataFrame) WriteTo

func (frame *MaxDataFrame) WriteTo(buffer *bytes.Buffer)

type MaxStreamDataFrame

type MaxStreamDataFrame struct {
	StreamId          uint64
	MaximumStreamData uint64
}

func NewMaxStreamDataFrame

func NewMaxStreamDataFrame(buffer *bytes.Reader) *MaxStreamDataFrame

func (*MaxStreamDataFrame) FrameLength

func (frame *MaxStreamDataFrame) FrameLength() uint16

func (*MaxStreamDataFrame) FrameType

func (frame *MaxStreamDataFrame) FrameType() FrameType

func (MaxStreamDataFrame) MarshalJSON added in v1.0.0

func (frame MaxStreamDataFrame) MarshalJSON() ([]byte, error)

func (*MaxStreamDataFrame) WriteTo

func (frame *MaxStreamDataFrame) WriteTo(buffer *bytes.Buffer)

type MaxStreamsFrame

type MaxStreamsFrame struct {
	StreamsType    StreamsType
	MaximumStreams uint64
}

func NewMaxStreamIdFrame

func NewMaxStreamIdFrame(buffer *bytes.Reader) *MaxStreamsFrame

func (*MaxStreamsFrame) FrameLength

func (frame *MaxStreamsFrame) FrameLength() uint16

func (*MaxStreamsFrame) FrameType

func (frame *MaxStreamsFrame) FrameType() FrameType

func (*MaxStreamsFrame) IsBidi

func (frame *MaxStreamsFrame) IsBidi() bool

func (*MaxStreamsFrame) IsUni

func (frame *MaxStreamsFrame) IsUni() bool

func (MaxStreamsFrame) MarshalJSON added in v1.0.0

func (frame MaxStreamsFrame) MarshalJSON() ([]byte, error)

func (*MaxStreamsFrame) WriteTo

func (frame *MaxStreamsFrame) WriteTo(buffer *bytes.Buffer)

type NewConnectionIdFrame

type NewConnectionIdFrame struct {
	Sequence            uint64
	RetirePriorTo       uint64
	Length              uint8
	ConnectionId        []byte
	StatelessResetToken [16]byte
}

func NewNewConnectionIdFrame

func NewNewConnectionIdFrame(buffer *bytes.Reader) *NewConnectionIdFrame

func (*NewConnectionIdFrame) FrameLength

func (frame *NewConnectionIdFrame) FrameLength() uint16

func (*NewConnectionIdFrame) FrameType

func (frame *NewConnectionIdFrame) FrameType() FrameType

func (NewConnectionIdFrame) MarshalJSON added in v1.0.0

func (frame NewConnectionIdFrame) MarshalJSON() ([]byte, error)

func (*NewConnectionIdFrame) WriteTo

func (frame *NewConnectionIdFrame) WriteTo(buffer *bytes.Buffer)

type NewTokenFrame

type NewTokenFrame struct {
	Token []byte
}

func ReadNewTokenFrame

func ReadNewTokenFrame(buffer *bytes.Reader, conn *Connection) *NewTokenFrame

func (*NewTokenFrame) FrameLength

func (frame *NewTokenFrame) FrameLength() uint16

func (*NewTokenFrame) FrameType

func (frame *NewTokenFrame) FrameType() FrameType

func (NewTokenFrame) MarshalJSON added in v1.0.0

func (frame NewTokenFrame) MarshalJSON() ([]byte, error)

func (*NewTokenFrame) WriteTo

func (frame *NewTokenFrame) WriteTo(buffer *bytes.Buffer)

type PNSpace

type PNSpace int
const (
	PNSpaceInitial PNSpace = iota
	PNSpaceHandshake
	PNSpaceAppData
	PNSpaceNoSpace
)

func (PNSpace) Epoch

func (pns PNSpace) Epoch() pigotls.Epoch

func (PNSpace) String

func (pns PNSpace) String() string

type Packet

type Packet interface {
	GetHeader() Header
	ShouldBeAcknowledged() bool // Indicates whether or not the packet type should be acknowledged by the mean of sending an ack
	EncodeHeader() []byte
	EncodePayload() []byte
	Encode([]byte) []byte
	Pointer() unsafe.Pointer
	PNSpace() PNSpace
	EncryptionLevel() EncryptionLevel
	ShortString() string
	MarshalJSON() ([]byte, error)
	ReceiveContext() PacketContext
	SetReceiveContext(ctx PacketContext)
	SendContext() PacketContext
	SetSendContext(ctx PacketContext)
}

type PacketAcknowledged

type PacketAcknowledged struct {
	PacketNumber
	PNSpace
}

type PacketContext

type PacketContext struct {
	Timestamp  time.Time
	RemoteAddr net.Addr
	ECNStatus
	DatagramSize uint16
	PacketSize   uint16
	WasBuffered  bool
}

type PacketNumber

type PacketNumber uint64

func ReadPacketNumber

func ReadPacketNumber(buffer *bytes.Reader) PacketNumber

func (PacketNumber) Truncate

func (p PacketNumber) Truncate(largestAcknowledged PacketNumber) TruncatedPN

type PacketNumberQueue

type PacketNumberQueue []PacketNumber

func (PacketNumberQueue) Len

func (a PacketNumberQueue) Len() int

func (PacketNumberQueue) Less

func (a PacketNumberQueue) Less(i, j int) bool

func (PacketNumberQueue) Swap

func (a PacketNumberQueue) Swap(i, j int)

type PacketToPrepare added in v1.0.0

type PacketToPrepare struct {
	EncryptionLevel
	*PacketNumber
}

type PacketToSend

type PacketToSend struct {
	Packet
	EncryptionLevel
}

type PacketType

type PacketType uint8
const (
	Initial          PacketType = 0x0
	ZeroRTTProtected PacketType = 0x1
	Handshake        PacketType = 0x2
	Retry            PacketType = 0x3

	StatelessReset     PacketType = 0xfd
	VersionNegotiation PacketType = 0xfe // TODO: Find a way around this
	ShortHeaderPacket  PacketType = 0xff // TODO: Find a way around this
)

func (PacketType) PNSpace

func (t PacketType) PNSpace() PNSpace

func (PacketType) String

func (t PacketType) String() string

type PaddingFrame

type PaddingFrame byte

func NewPaddingFrame

func NewPaddingFrame(buffer *bytes.Reader) *PaddingFrame

func (*PaddingFrame) FrameLength

func (frame *PaddingFrame) FrameLength() uint16

func (*PaddingFrame) FrameType

func (frame *PaddingFrame) FrameType() FrameType

func (PaddingFrame) MarshalJSON added in v1.0.0

func (frame PaddingFrame) MarshalJSON() ([]byte, error)

func (*PaddingFrame) WriteTo

func (frame *PaddingFrame) WriteTo(buffer *bytes.Buffer)

type PathChallenge

type PathChallenge struct {
	Data [8]byte
}

func ReadPathChallenge

func ReadPathChallenge(buffer *bytes.Reader) *PathChallenge

func (*PathChallenge) FrameLength

func (frame *PathChallenge) FrameLength() uint16

func (*PathChallenge) FrameType

func (frame *PathChallenge) FrameType() FrameType

func (PathChallenge) MarshalJSON added in v1.0.0

func (frame PathChallenge) MarshalJSON() ([]byte, error)

func (*PathChallenge) WriteTo

func (frame *PathChallenge) WriteTo(buffer *bytes.Buffer)

type PathResponse

type PathResponse struct {
	Data [8]byte
}

func NewPathResponse

func NewPathResponse(data [8]byte) *PathResponse

func ReadPathResponse

func ReadPathResponse(buffer *bytes.Reader) *PathResponse

func (*PathResponse) FrameLength

func (frame *PathResponse) FrameLength() uint16

func (*PathResponse) FrameType

func (frame *PathResponse) FrameType() FrameType

func (PathResponse) MarshalJSON added in v1.0.0

func (frame PathResponse) MarshalJSON() ([]byte, error)

func (*PathResponse) WriteTo

func (frame *PathResponse) WriteTo(buffer *bytes.Buffer)

type PingFrame

type PingFrame byte

func NewPingFrame

func NewPingFrame(buffer *bytes.Reader) *PingFrame

func (*PingFrame) FrameLength

func (frame *PingFrame) FrameLength() uint16

func (*PingFrame) FrameType

func (frame *PingFrame) FrameType() FrameType

func (PingFrame) MarshalJSON added in v1.0.0

func (frame PingFrame) MarshalJSON() ([]byte, error)

func (*PingFrame) WriteTo

func (frame *PingFrame) WriteTo(buffer *bytes.Buffer)

type ProtectedPacket

type ProtectedPacket struct {
	FramePacket
}

func NewProtectedPacket

func NewProtectedPacket(conn *Connection) *ProtectedPacket

func ReadProtectedPacket

func ReadProtectedPacket(buffer *bytes.Reader, conn *Connection) *ProtectedPacket

func (*ProtectedPacket) EncryptionLevel

func (p *ProtectedPacket) EncryptionLevel() EncryptionLevel

func (ProtectedPacket) MarshalJSON added in v1.0.0

func (p ProtectedPacket) MarshalJSON() ([]byte, error)

func (*ProtectedPacket) PNSpace

func (p *ProtectedPacket) PNSpace() PNSpace

type QueuedFrame

type QueuedFrame struct {
	Frame
	EncryptionLevel
}

type QuicTransportParameters

type QuicTransportParameters struct {
	OriginalDestinationConnectionId ConnectionID
	IdleTimeout                     uint64
	StatelessResetToken             []byte
	MaxPacketSize                   uint64
	MaxData                         uint64
	MaxStreamDataBidiLocal          uint64
	MaxStreamDataBidiRemote         uint64
	MaxStreamDataUni                uint64
	MaxBidiStreams                  uint64
	MaxUniStreams                   uint64
	AckDelayExponent                uint64
	MaxAckDelay                     uint64
	DisableMigration                bool
	PreferredAddress                []byte
	ActiveConnectionIdLimit         uint64
	InitialSourceConnectionId       ConnectionID
	RetrySourceConnectionId         ConnectionID
	AdditionalParameters            TransportParameterList
	ToJSON                          map[string]interface{}
}

type ResetStream

type ResetStream struct {
	StreamId             uint64
	ApplicationErrorCode uint64
	FinalSize            uint64
}

func NewResetStream

func NewResetStream(buffer *bytes.Reader) *ResetStream

func (*ResetStream) FrameLength

func (frame *ResetStream) FrameLength() uint16

func (*ResetStream) FrameType

func (frame *ResetStream) FrameType() FrameType

func (ResetStream) MarshalJSON added in v1.0.0

func (frame ResetStream) MarshalJSON() ([]byte, error)

func (*ResetStream) WriteTo

func (frame *ResetStream) WriteTo(buffer *bytes.Buffer)

type RetireConnectionId

type RetireConnectionId struct {
	SequenceNumber uint64
}

func ReadRetireConnectionId

func ReadRetireConnectionId(buffer *bytes.Reader) *RetireConnectionId

func (*RetireConnectionId) FrameLength

func (frame *RetireConnectionId) FrameLength() uint16

func (*RetireConnectionId) FrameType

func (frame *RetireConnectionId) FrameType() FrameType

func (RetireConnectionId) MarshalJSON added in v1.0.0

func (frame RetireConnectionId) MarshalJSON() ([]byte, error)

func (*RetireConnectionId) WriteTo

func (frame *RetireConnectionId) WriteTo(buffer *bytes.Buffer)

type RetryPacket

type RetryPacket struct {
	AbstractPacket
	RetryToken        []byte
	RetryIntegrityTag [16]byte
}

func ReadRetryPacket

func ReadRetryPacket(buffer *bytes.Reader, conn *Connection) *RetryPacket

func (*RetryPacket) EncodePayload

func (p *RetryPacket) EncodePayload() []byte

func (*RetryPacket) EncryptionLevel

func (p *RetryPacket) EncryptionLevel() EncryptionLevel

func (*RetryPacket) GetRetransmittableFrames

func (p *RetryPacket) GetRetransmittableFrames() []Frame

func (RetryPacket) MarshalJSON added in v1.0.0

func (p RetryPacket) MarshalJSON() ([]byte, error)

func (*RetryPacket) PNSpace

func (p *RetryPacket) PNSpace() PNSpace

func (*RetryPacket) Pointer

func (p *RetryPacket) Pointer() unsafe.Pointer

func (*RetryPacket) ShouldBeAcknowledged

func (p *RetryPacket) ShouldBeAcknowledged() bool

type RetryPseudoPacket

type RetryPseudoPacket struct {
	OriginalDestinationCID ConnectionID
	UnusedByte             byte
	Version                uint32
	DestinationCID         ConnectionID
	SourceCID              ConnectionID
	RetryToken             []byte
}

func (*RetryPseudoPacket) Encode

func (r *RetryPseudoPacket) Encode() []byte

type Secrets

type Secrets struct {
	Epoch pigotls.Epoch `json:"epoch"`
	Read  []byte        `json:"read"`
	Write []byte        `json:"write"`
}

type ShortHeader

type ShortHeader struct {
	SpinBit        SpinBit
	KeyPhase       KeyPhaseBit
	DestinationCID ConnectionID
	TruncatedPN    TruncatedPN
	PacketNumber   PacketNumber
}

func NewShortHeader

func NewShortHeader(conn *Connection) *ShortHeader

func ReadShortHeader

func ReadShortHeader(buffer *bytes.Reader, conn *Connection) *ShortHeader

func (*ShortHeader) DestinationConnectionID

func (h *ShortHeader) DestinationConnectionID() ConnectionID

func (*ShortHeader) Encode

func (h *ShortHeader) Encode() []byte

func (*ShortHeader) EncryptionLevel

func (h *ShortHeader) EncryptionLevel() EncryptionLevel

func (*ShortHeader) GetPacketNumber

func (h *ShortHeader) GetPacketNumber() PacketNumber

func (*ShortHeader) GetPacketType

func (h *ShortHeader) GetPacketType() PacketType

func (*ShortHeader) GetTruncatedPN

func (h *ShortHeader) GetTruncatedPN() TruncatedPN

func (*ShortHeader) HeaderLength

func (h *ShortHeader) HeaderLength() int

func (ShortHeader) MarshalJSON added in v1.0.0

func (h ShortHeader) MarshalJSON() ([]byte, error)

func (*ShortHeader) SetPacketNumber added in v1.0.0

func (h *ShortHeader) SetPacketNumber(number PacketNumber)

type SpinBit

type SpinBit bool
const SpinValueOne SpinBit = true
const SpinValueZero SpinBit = false

type StatelessResetPacket

type StatelessResetPacket struct {
	AbstractPacket
	UnpredictableBits   []byte
	StatelessResetToken [16]byte
}

func ReadStatelessResetPacket

func ReadStatelessResetPacket(buffer *bytes.Reader) *StatelessResetPacket

func (StatelessResetPacket) EncodePayload

func (StatelessResetPacket) EncodePayload() []byte

func (*StatelessResetPacket) EncryptionLevel

func (*StatelessResetPacket) EncryptionLevel() EncryptionLevel

func (StatelessResetPacket) MarshalJSON added in v1.0.0

func (p StatelessResetPacket) MarshalJSON() ([]byte, error)

func (*StatelessResetPacket) PNSpace

func (*StatelessResetPacket) PNSpace() PNSpace

func (*StatelessResetPacket) Pointer

func (p *StatelessResetPacket) Pointer() unsafe.Pointer

func (*StatelessResetPacket) ShouldBeAcknowledged

func (*StatelessResetPacket) ShouldBeAcknowledged() bool

type StopSendingFrame

type StopSendingFrame struct {
	StreamId             uint64
	ApplicationErrorCode uint64
}

func NewStopSendingFrame

func NewStopSendingFrame(buffer *bytes.Reader) *StopSendingFrame

func (*StopSendingFrame) FrameLength

func (frame *StopSendingFrame) FrameLength() uint16

func (*StopSendingFrame) FrameType

func (frame *StopSendingFrame) FrameType() FrameType

func (StopSendingFrame) MarshalJSON added in v1.0.0

func (frame StopSendingFrame) MarshalJSON() ([]byte, error)

func (*StopSendingFrame) WriteTo

func (frame *StopSendingFrame) WriteTo(buffer *bytes.Buffer)

type Stream

type Stream struct {
	ReadOffset  uint64
	WriteOffset uint64

	ReadLimit        uint64
	ReadBufferOffset uint64
	WriteLimit       uint64
	WriteReserved    uint64

	ReadData  []byte
	WriteData []byte

	ReadChan Broadcaster

	ReadClosed       bool
	ReadCloseOffset  uint64
	WriteClosed      bool
	WriteCloseOffset uint64
	// contains filtered or unexported fields
}

func NewStream

func NewStream() *Stream

type StreamDataBlockedFrame

type StreamDataBlockedFrame struct {
	StreamId        uint64
	StreamDataLimit uint64
}

func NewStreamBlockedFrame

func NewStreamBlockedFrame(buffer *bytes.Reader) *StreamDataBlockedFrame

func (*StreamDataBlockedFrame) FrameLength

func (frame *StreamDataBlockedFrame) FrameLength() uint16

func (*StreamDataBlockedFrame) FrameType

func (frame *StreamDataBlockedFrame) FrameType() FrameType

func (StreamDataBlockedFrame) MarshalJSON added in v1.0.0

func (frame StreamDataBlockedFrame) MarshalJSON() ([]byte, error)

func (*StreamDataBlockedFrame) WriteTo

func (frame *StreamDataBlockedFrame) WriteTo(buffer *bytes.Buffer)

type StreamFrame

type StreamFrame struct {
	FinBit bool
	LenBit bool
	OffBit bool

	StreamId   uint64
	Offset     uint64
	Length     uint64
	StreamData []byte
}

func NewStreamFrame

func NewStreamFrame(streamId, offset uint64, data []byte, finBit bool) *StreamFrame

func ReadStreamFrame

func ReadStreamFrame(buffer *bytes.Reader, conn *Connection) *StreamFrame

func (*StreamFrame) FrameLength

func (frame *StreamFrame) FrameLength() uint16

func (*StreamFrame) FrameType

func (frame *StreamFrame) FrameType() FrameType

func (StreamFrame) MarshalJSON added in v1.0.0

func (frame StreamFrame) MarshalJSON() ([]byte, error)

func (*StreamFrame) WriteTo

func (frame *StreamFrame) WriteTo(buffer *bytes.Buffer)

type StreamInput

type StreamInput struct {
	StreamId     uint64
	Data         []byte
	Close        bool
	Reset        bool
	StopSending  bool
	AppErrorCode uint64
}

type Streams

type Streams struct {
	// contains filtered or unexported fields
}

func (Streams) Close

func (s Streams) Close(streamId uint64)

func (Streams) Get

func (s Streams) Get(streamId uint64) *Stream

func (Streams) GetAll

func (s Streams) GetAll() map[uint64]*Stream

func (Streams) Has

func (s Streams) Has(streamId uint64) (*Stream, bool)

func (Streams) NumberOfServerStreamsOpen

func (s Streams) NumberOfServerStreamsOpen() int

func (Streams) Reset

func (s Streams) Reset(streamId uint64, appErrorCode uint64)

func (Streams) Send

func (s Streams) Send(streamId uint64, data []byte, close bool)

func (Streams) StopSending

func (s Streams) StopSending(streamId uint64, appErrorCode uint64)

type StreamsBlockedFrame

type StreamsBlockedFrame struct {
	StreamsType StreamsType
	StreamLimit uint64
}

func NewStreamIdNeededFrame

func NewStreamIdNeededFrame(buffer *bytes.Reader) *StreamsBlockedFrame

func (*StreamsBlockedFrame) FrameLength

func (frame *StreamsBlockedFrame) FrameLength() uint16

func (*StreamsBlockedFrame) FrameType

func (frame *StreamsBlockedFrame) FrameType() FrameType

func (*StreamsBlockedFrame) IsBidi

func (frame *StreamsBlockedFrame) IsBidi() bool

func (*StreamsBlockedFrame) IsUni

func (frame *StreamsBlockedFrame) IsUni() bool

func (StreamsBlockedFrame) MarshalJSON added in v1.0.0

func (frame StreamsBlockedFrame) MarshalJSON() ([]byte, error)

func (*StreamsBlockedFrame) WriteTo

func (frame *StreamsBlockedFrame) WriteTo(buffer *bytes.Buffer)

type StreamsType

type StreamsType bool
const (
	BidiStreams StreamsType = false
	UniStreams              = true
)

func (StreamsType) String

func (s StreamsType) String() string

type SupportedVersion

type SupportedVersion uint32

func (SupportedVersion) String

func (v SupportedVersion) String() string

type TLSTransportParameterHandler

type TLSTransportParameterHandler struct {
	QuicTransportParameters
	*EncryptedExtensionsTransportParameters
	ReceivedParameters *QuicTransportParameters
}

func NewTLSTransportParameterHandler

func NewTLSTransportParameterHandler(scid ConnectionID) *TLSTransportParameterHandler

func (*TLSTransportParameterHandler) GetExtensionData

func (h *TLSTransportParameterHandler) GetExtensionData() ([]byte, error)

func (*TLSTransportParameterHandler) ReceiveExtensionData

func (h *TLSTransportParameterHandler) ReceiveExtensionData(data []byte) error

type Trace

type Trace struct {
	Commit          string                    `json:"commit"`   // The git commit that versions the code that produced the trace
	Scenario        string                    `json:"scenario"` // The id of the scenario that produced the trace
	ScenarioVersion int                       `json:"scenario_version"`
	Host            string                    `json:"host"`       // The host against which the scenario was run
	Ip              string                    `json:"ip"`         // The IP that was resolved for the given host
	Results         map[string]interface{}    `json:"results"`    // A dictionary that allows to report scenario-specific results
	StartedAt       int64                     `json:"started_at"` // The time at which the scenario started in epoch seconds
	Duration        uint64                    `json:"duration"`   // Its duration in epoch milliseconds
	ErrorCode       uint8                     `json:"error_code"` // A scenario-specific error code that reports its verdict
	Stream          []TracePacket             `json:"stream"`     // A clear-text copy of the packets that were sent and received
	Pcap            []byte                    `json:"pcap"`       // The packet capture file associated with the trace
	QLog            interface{}               `json:"qlog"`       // The QLog trace captured during the test run
	ClientRandom    []byte                    `json:"client_random"`
	Secrets         map[pigotls.Epoch]Secrets `json:"secrets"`
}

Contains the result of a test run against a given host.

func NewTrace

func NewTrace(scenarioName string, scenarioVersion int, host string) *Trace

func (*Trace) AddPcap

func (t *Trace) AddPcap(conn *Connection, cmd *exec.Cmd) error

func (*Trace) AttachTo

func (t *Trace) AttachTo(conn *Connection)

func (*Trace) Complete

func (t *Trace) Complete(conn *Connection)

func (*Trace) MarkError

func (t *Trace) MarkError(error uint8, message string, packet Packet)

type TracePacket

type TracePacket struct {
	Direction    Direction      `json:"direction"`
	Timestamp    int64          `json:"timestamp"`
	Data         []byte         `json:"data"`
	IsOfInterest bool           `json:"is_of_interest"`
	Pointer      unsafe.Pointer `json:"-"`
}

type TransportParameter

type TransportParameter struct {
	ParameterType TransportParametersType
	Value         []byte `tls:"head=2"`
}

type TransportParameterList

type TransportParameterList []TransportParameter

func (*TransportParameterList) AddParameter

func (list *TransportParameterList) AddParameter(p TransportParameter)

func (*TransportParameterList) GetParameter

func (list *TransportParameterList) GetParameter(id TransportParametersType) []byte

type TransportParametersType

type TransportParametersType uint64

type TruncatedPN

type TruncatedPN struct {
	Value  uint32
	Length int
}

func ReadTruncatedPN

func ReadTruncatedPN(buffer *bytes.Reader, length int) TruncatedPN

func (TruncatedPN) Encode

func (t TruncatedPN) Encode() []byte

func (TruncatedPN) Join

func (*TruncatedPN) SetLength

func (t *TruncatedPN) SetLength(length int)

type UnprocessedPayload

type UnprocessedPayload struct {
	IncomingPayload
	EncryptionLevel
}

type VarInt

type VarInt struct {
	Value  uint64
	Length int
}

func NewVarInt

func NewVarInt(value uint64) VarInt

func ReadVarInt

func ReadVarInt(buffer io.ByteReader) (VarInt, error)

func (VarInt) Encode

func (v VarInt) Encode() []byte

type VersionNegotiationPacket

type VersionNegotiationPacket struct {
	AbstractPacket
	UnusedField       uint8
	Version           uint32
	DestinationCID    ConnectionID
	SourceCID         ConnectionID
	SupportedVersions []SupportedVersion
}

func NewVersionNegotiationPacket

func NewVersionNegotiationPacket(unusedField uint8, version uint32, versions []SupportedVersion, conn *Connection) *VersionNegotiationPacket

func ReadVersionNegotationPacket

func ReadVersionNegotationPacket(buffer *bytes.Reader) *VersionNegotiationPacket

func (*VersionNegotiationPacket) EncodePayload

func (p *VersionNegotiationPacket) EncodePayload() []byte

func (*VersionNegotiationPacket) EncryptionLevel

func (p *VersionNegotiationPacket) EncryptionLevel() EncryptionLevel

func (VersionNegotiationPacket) MarshalJSON added in v1.0.0

func (p VersionNegotiationPacket) MarshalJSON() ([]byte, error)

func (*VersionNegotiationPacket) PNSpace

func (p *VersionNegotiationPacket) PNSpace() PNSpace

func (*VersionNegotiationPacket) Pointer

func (*VersionNegotiationPacket) ShouldBeAcknowledged

func (p *VersionNegotiationPacket) ShouldBeAcknowledged() bool

type ZeroRTTProtectedPacket

type ZeroRTTProtectedPacket struct {
	FramePacket
}

func NewZeroRTTProtectedPacket

func NewZeroRTTProtectedPacket(conn *Connection) *ZeroRTTProtectedPacket

func (*ZeroRTTProtectedPacket) EncryptionLevel

func (p *ZeroRTTProtectedPacket) EncryptionLevel() EncryptionLevel

func (ZeroRTTProtectedPacket) MarshalJSON added in v1.0.0

func (p ZeroRTTProtectedPacket) MarshalJSON() ([]byte, error)

func (*ZeroRTTProtectedPacket) PNSpace

func (p *ZeroRTTProtectedPacket) PNSpace() PNSpace

Directories

Path Synopsis
This package contains pieces of behaviours that constitutes a QUIC client.
This package contains pieces of behaviours that constitutes a QUIC client.
bin
This package contains all the test scenarii that are part of the test suite.
This package contains all the test scenarii that are part of the test suite.

Jump to

Keyboard shortcuts

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