protocol

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const AckSendDelay = 25 * time.Millisecond

AckSendDelay is the maximum delay that can be applied to an ACK for a retransmittable packet This is the value Chromium is using

View Source
const ClosedSessionDeleteTimeout = time.Minute

ClosedSessionDeleteTimeout the server ignores packets arriving on a connection that is already closed after this time all information about the old connection will be deleted

View Source
const ConnectionFlowControlMultiplier = 1.5

ConnectionFlowControlMultiplier determines how much larger the connection flow control windows needs to be relative to any stream's flow control window This is the value that Chromium is using

View Source
const CookieExpiryTime = 24 * time.Hour

CookieExpiryTime is the valid time of a cookie

View Source
const CryptoMaxParams = 128

CryptoMaxParams is the upper limit for the number of parameters in a crypto message. Value taken from Chrome.

View Source
const CryptoParameterMaxLength = 4000

CryptoParameterMaxLength is the upper limit for the length of a parameter in a crypto message.

View Source
const DefaultHandshakeTimeout = 10 * time.Second

DefaultHandshakeTimeout is the default timeout for a connection until the crypto handshake succeeds.

View Source
const DefaultIdleTimeout = 30 * time.Second

DefaultIdleTimeout is the default idle timeout

View Source
const DefaultMaxCongestionWindow = 1000

DefaultMaxCongestionWindow is the default for the max congestion window

View Source
const DefaultMaxReceiveConnectionFlowControlWindowClient = 15 * (1 << 20) // 15 MB

DefaultMaxReceiveConnectionFlowControlWindowClient is the default connection-level flow control window for receiving data, for the client This is the value that Google servers are using

View Source
const DefaultMaxReceiveConnectionFlowControlWindowServer = 1.5 * (1 << 20) // 1.5 MB

DefaultMaxReceiveConnectionFlowControlWindowServer is the default connection-level flow control window for receiving data, for the server This is the value that Google servers are using

View Source
const DefaultMaxReceiveStreamFlowControlWindowClient = 6 * (1 << 20) // 6 MB

DefaultMaxReceiveStreamFlowControlWindowClient is the default maximum stream-level flow control window for receiving data, for the client This is the value that Chromium is using

View Source
const DefaultMaxReceiveStreamFlowControlWindowServer = 1 * (1 << 20) // 1 MB

DefaultMaxReceiveStreamFlowControlWindowServer is the default maximum stream-level flow control window for receiving data, for the server This is the value that Google servers are using

View Source
const EphermalKeyLifetime = time.Minute

EphermalKeyLifetime is the lifetime of the ephermal key during the handshake, see handshake.getEphermalKEX.

View Source
const InitialCongestionWindow = 32

InitialCongestionWindow is the initial congestion window in QUIC packets

View Source
const MaxByteCount = ByteCount(1<<62 - 1)

MaxByteCount is the maximum value of a ByteCount

View Source
const MaxClientHellos = 3

MaxClientHellos is the maximum number of times we'll send a client hello The value 3 accounts for: * one failure due to an incorrect or missing source-address token * one failure due the server's certificate chain being unavailible and the server being unwilling to send it without a valid source-address token

View Source
const MaxIncomingStreams = 100

MaxIncomingStreams is the maximum number of streams that a peer may open

View Source
const MaxNewStreamIDDelta = 4 * MaxIncomingStreams

MaxNewStreamIDDelta is the maximum difference between and a newly opened Stream and the highest StreamID that a client has ever opened note that the number of streams is half this value, since the client can only open streams with open StreamID

View Source
const MaxNonRetransmittableAcks = 19

MaxNonRetransmittableAcks is the maximum number of packets containing an ACK, but no retransmittable frames, that we send in a row

View Source
const MaxSessionUnprocessedPackets = DefaultMaxCongestionWindow

MaxSessionUnprocessedPackets is the max number of packets stored in each session that are not yet processed.

View Source
const MaxStreamFrameSorterGaps = 1000

MaxStreamFrameSorterGaps is the maximum number of gaps between received StreamFrames prevents DoS attacks against the streamFrameSorter

View Source
const MaxStreamsMinimumIncrement = 10

MaxStreamsMinimumIncrement is the slack the client is allowed for the maximum number of streams per connection, needed e.g. when packets are out of order or dropped. The minimum of this absolute increment and the procentual increase specified by MaxStreamsMultiplier is used.

View Source
const MaxStreamsMultiplier = 1.1

MaxStreamsMultiplier is the slack the client is allowed for the maximum number of streams per connection, needed e.g. when packets are out of order or dropped. The minimum of this procentual increase and the absolute increment specified by MaxStreamsMinimumIncrement is used.

View Source
const MaxTrackedReceivedAckRanges = DefaultMaxCongestionWindow

MaxTrackedReceivedAckRanges is the maximum number of ACK ranges tracked

View Source
const MaxTrackedSentPackets = 2 * DefaultMaxCongestionWindow

MaxTrackedSentPackets is maximum number of sent packets saved for either later retransmission or entropy calculation

View Source
const MaxTrackedSkippedPackets = 10

MaxTrackedSkippedPackets is the maximum number of skipped packet numbers the SentPacketHandler keep track of for Optimistic ACK attack mitigation

View Source
const MaxUndecryptablePackets = 10

MaxUndecryptablePackets limits the number of undecryptable packets that a session queues for later until it sends a public reset.

View Source
const MinClientHelloSize = 1024

MinClientHelloSize is the minimum size the server expects an inchoate CHLO to have (in gQUIC)

View Source
const MinInitialPacketSize = 1200

MinInitialPacketSize is the minimum size an Initial packet (in IETF QUIC) is requried to have.

View Source
const MinPacingDelay time.Duration = 100 * time.Microsecond

MinPacingDelay is the minimum duration that is used for packet pacing If the packet packing frequency is higher, multiple packets might be sent at once. Example: For a packet pacing delay of 20 microseconds, we would send 5 packets at once, wait for 100 microseconds, and so forth.

View Source
const MinRemoteIdleTimeout = 5 * time.Second

MinRemoteIdleTimeout is the minimum value that we accept for the remote idle timeout

View Source
const NonForwardSecurePacketSizeReduction = 50

NonForwardSecurePacketSizeReduction is the number of bytes a non forward-secure packet has to be smaller than a forward-secure packet This makes sure that those packets can always be retransmitted without splitting the contained StreamFrames

View Source
const NumCachedCertificates = 128

NumCachedCertificates is the number of cached compressed certificate chains, each taking ~1K space

View Source
const PublicResetTimeout = 500 * time.Millisecond

PublicResetTimeout is the time to wait before sending a Public Reset when receiving too many undecryptable packets during the handshake This timeout allows the Go scheduler to switch to the Go rountine that reads the crypto stream and to escalate the crypto

View Source
const ReceiveConnectionFlowControlWindow = (1 << 10) * 48 // 48 kB

ReceiveConnectionFlowControlWindow is the connection-level flow control window for receiving data This is the value that Google servers are using

View Source
const ReceiveStreamFlowControlWindow = (1 << 10) * 32 // 32 kB

ReceiveStreamFlowControlWindow is the stream-level flow control window for receiving data This is the value that Google servers are using

View Source
const RetransmittablePacketsBeforeAck = 10

RetransmittablePacketsBeforeAck is the number of retransmittable that an ACK is sent for

View Source
const WindowUpdateThreshold = 0.25

WindowUpdateThreshold is the fraction of the receive window that has to be consumed before an higher offset is advertised to the client

Variables

View Source
var SupportedVersions = []VersionNumber{
	Version39,
}

SupportedVersions lists the versions that the server supports must be in sorted descending order

Functions

func IsSupportedVersion

func IsSupportedVersion(supported []VersionNumber, v VersionNumber) bool

IsSupportedVersion returns true if the server supports this version

Types

type ApplicationErrorCode added in v0.7.0

type ApplicationErrorCode uint16

An ApplicationErrorCode is an application-defined error code.

type ByteCount

type ByteCount uint64

A ByteCount in QUIC

const DefaultTCPMSS ByteCount = 1460

DefaultTCPMSS is the default maximum packet size used in the Linux TCP implementation. Used in QUIC for congestion window computations in bytes.

const MaxPacketSize ByteCount = 1200

MaxPacketSize is the maximum packet size that we use for sending packets. It includes the QUIC packet header, but excludes the UDP and IP header.

const MaxReceivePacketSize ByteCount = 1452

MaxReceivePacketSize maximum packet size of any QUIC packet, based on ethernet's max size, minus the IP and UDP headers. IPv6 has a 40 byte header, UDP adds an additional 8 bytes. This is a total overhead of 48 bytes. Ethernet's max packet size is 1500 bytes, 1500 - 48 = 1452.

const MinStreamFrameSize ByteCount = 128

MinStreamFrameSize is the minimum size that has to be left in a packet, so that we add another STREAM frame. This avoids splitting up STREAM frames into small pieces, which has 2 advantages: 1. it reduces the framing overhead 2. it reduces the head-of-line blocking, when a packet is lost

type ConnectionID

type ConnectionID uint64

A ConnectionID in QUIC

type EncryptionLevel

type EncryptionLevel int

EncryptionLevel is the encryption level Default value is Unencrypted

const (
	// EncryptionUnspecified is a not specified encryption level
	EncryptionUnspecified EncryptionLevel = iota
	// EncryptionUnencrypted is not encrypted
	EncryptionUnencrypted
	// EncryptionSecure is encrypted, but not forward secure
	EncryptionSecure
	// EncryptionForwardSecure is forward secure
	EncryptionForwardSecure
)

func (EncryptionLevel) String

func (e EncryptionLevel) String() string

type PacketNumber

type PacketNumber uint64

A PacketNumber in QUIC

const SkipPacketAveragePeriodLength PacketNumber = 500

SkipPacketAveragePeriodLength is the average period length in which one packet number is skipped to prevent an Optimistic ACK attack

func InferPacketNumber

func InferPacketNumber(packetNumberLength PacketNumberLen, lastPacketNumber PacketNumber, wirePacketNumber PacketNumber) PacketNumber

InferPacketNumber calculates the packet number based on the received packet number, its length and the last seen packet number

type PacketNumberLen

type PacketNumberLen uint8

PacketNumberLen is the length of the packet number in bytes

const (
	// PacketNumberLenInvalid is the default value and not a valid length for a packet number
	PacketNumberLenInvalid PacketNumberLen = 0
	// PacketNumberLen1 is a packet number length of 1 byte
	PacketNumberLen1 PacketNumberLen = 1
	// PacketNumberLen2 is a packet number length of 2 bytes
	PacketNumberLen2 PacketNumberLen = 2
	// PacketNumberLen4 is a packet number length of 4 bytes
	PacketNumberLen4 PacketNumberLen = 4
	// PacketNumberLen6 is a packet number length of 6 bytes
	PacketNumberLen6 PacketNumberLen = 6
)

func GetPacketNumberLength

func GetPacketNumberLength(packetNumber PacketNumber) PacketNumberLen

GetPacketNumberLength gets the minimum length needed to fully represent the packet number

func GetPacketNumberLengthForHeader

func GetPacketNumberLengthForHeader(packetNumber PacketNumber, leastUnacked PacketNumber) PacketNumberLen

GetPacketNumberLengthForHeader gets the length of the packet number for the public header it never chooses a PacketNumberLen of 1 byte, since this is too short under certain circumstances

type PacketType

type PacketType uint8

The PacketType is the Long Header Type (only used for the IETF draft header format)

const (
	// PacketTypeInitial is the packet type of a Initial packet
	PacketTypeInitial PacketType = 2
	// PacketTypeRetry is the packet type of a Retry packet
	PacketTypeRetry PacketType = 3
	// PacketTypeHandshake is the packet type of a Cleartext packet
	PacketTypeHandshake PacketType = 4
	// PacketType0RTT is the packet type of a 0-RTT packet
	PacketType0RTT PacketType = 5
)

func (PacketType) String

func (t PacketType) String() string

type Perspective

type Perspective int

Perspective determines if we're acting as a server or a client

const (
	PerspectiveServer Perspective = 1
	PerspectiveClient Perspective = 2
)

the perspectives

func (Perspective) String added in v0.7.0

func (p Perspective) String() string

type StreamID

type StreamID uint64

A StreamID in QUIC

type VersionNumber

type VersionNumber int32

VersionNumber is a version number as int

const (
	Version39       VersionNumber = gquicVersion0 + 3*0x100 + 0x9 + iota
	VersionTLS      VersionNumber = 101
	VersionWhatever VersionNumber = 0 // for when the version doesn't matter
	VersionUnknown  VersionNumber = -1
)

The version numbers, making grepping easier

func ChooseSupportedVersion

func ChooseSupportedVersion(ours, theirs []VersionNumber) (VersionNumber, bool)

ChooseSupportedVersion finds the best version in the overlap of ours and theirs ours is a slice of versions that we support, sorted by our preference (descending) theirs is a slice of versions offered by the peer. The order does not matter. The bool returned indicates if a matching version was found.

func GetGreasedVersions

func GetGreasedVersions(supported []VersionNumber) []VersionNumber

GetGreasedVersions adds one reserved version number to a slice of version numbers, at a random position

func (VersionNumber) CryptoStreamID

func (vn VersionNumber) CryptoStreamID() StreamID

CryptoStreamID gets the Stream ID of the crypto stream

func (VersionNumber) StreamContributesToConnectionFlowControl

func (vn VersionNumber) StreamContributesToConnectionFlowControl(id StreamID) bool

StreamContributesToConnectionFlowControl says if a stream contributes to connection-level flow control

func (VersionNumber) String

func (vn VersionNumber) String() string

func (VersionNumber) ToAltSvc

func (vn VersionNumber) ToAltSvc() string

ToAltSvc returns the representation of the version for the H2 Alt-Svc parameters

func (VersionNumber) UsesIETFFrameFormat

func (vn VersionNumber) UsesIETFFrameFormat() bool

UsesIETFFrameFormat tells if this version uses the IETF frame format

func (VersionNumber) UsesTLS

func (vn VersionNumber) UsesTLS() bool

UsesTLS says if this QUIC version uses TLS 1.3 for the handshake

Jump to

Keyboard shortcuts

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