ackhandler

package
v0.0.6-firefox.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasAckElicitingFrames

func HasAckElicitingFrames(fs []Frame) bool

HasAckElicitingFrames returns true if at least one frame is ack-eliciting.

func IsFrameAckEliciting

func IsFrameAckEliciting(f wire.Frame) bool

IsFrameAckEliciting returns true if the frame is ack-eliciting.

func IsFrameTypeAckEliciting

func IsFrameTypeAckEliciting(t wire.FrameType) bool

IsFrameTypeAckEliciting returns true if the frame is ack-eliciting.

func SetInitialPacketNumberLength

func SetInitialPacketNumberLength(h SentPacketHandler, pnLen protocol.PacketNumberLen)

SetInitialPacketNumberLength sets a single PN encoding length used for ALL Initial packets. Deprecated: prefer SetInitialPacketNumberLengths for per-packet control.

func SetInitialPacketNumberLengths

func SetInitialPacketNumberLengths(h SentPacketHandler, base protocol.PacketNumber, pnLens []protocol.PacketNumberLen)

SetInitialPacketNumberLengths sets per-packet PN encoding lengths for Initial packets. base is the PN of the first Initial packet (InitPacketNumber). pnLens[0] applies to PN=base, pnLens[1] to PN=base+1, etc. If the packet's PN index exceeds len(pnLens), the last entry repeats. When set, this overrides any value set by SetInitialPacketNumberLength.

Types

type Frame

type Frame struct {
	Frame   wire.Frame // nil if the frame has already been acknowledged in another packet
	Handler FrameHandler
}

type FrameHandler

type FrameHandler interface {
	OnAcked(wire.Frame)
	OnLost(wire.Frame)
}

FrameHandler handles the acknowledgement and the loss of a frame.

type ReceivedPacketHandler

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

func NewReceivedPacketHandler

func NewReceivedPacketHandler(logger utils.Logger) *ReceivedPacketHandler

func (*ReceivedPacketHandler) DropPackets

func (h *ReceivedPacketHandler) DropPackets(encLevel protocol.EncryptionLevel)

func (*ReceivedPacketHandler) GetAckFrame

func (h *ReceivedPacketHandler) GetAckFrame(encLevel protocol.EncryptionLevel, now monotime.Time, onlyIfQueued bool) *wire.AckFrame

func (*ReceivedPacketHandler) GetAlarmTimeout

func (h *ReceivedPacketHandler) GetAlarmTimeout() monotime.Time

func (*ReceivedPacketHandler) IgnorePacketsBelow

func (h *ReceivedPacketHandler) IgnorePacketsBelow(pn protocol.PacketNumber)

func (*ReceivedPacketHandler) IsPotentiallyDuplicate

func (h *ReceivedPacketHandler) IsPotentiallyDuplicate(pn protocol.PacketNumber, encLevel protocol.EncryptionLevel) bool

func (*ReceivedPacketHandler) ReceivedPacket

func (h *ReceivedPacketHandler) ReceivedPacket(
	pn protocol.PacketNumber,
	ecn protocol.ECN,
	encLevel protocol.EncryptionLevel,
	rcvTime monotime.Time,
	ackEliciting bool,
) error

type SendMode

type SendMode uint8

The SendMode says what kind of packets can be sent.

const (
	// SendNone means that no packets should be sent
	SendNone SendMode = iota
	// SendAck means an ACK-only packet should be sent
	SendAck
	// SendPTOInitial means that an Initial probe packet should be sent
	SendPTOInitial
	// SendPTOHandshake means that a Handshake probe packet should be sent
	SendPTOHandshake
	// SendPTOAppData means that an Application data probe packet should be sent
	SendPTOAppData
	// SendPacingLimited means that the pacer doesn't allow sending of a packet right now,
	// but will do in a little while.
	// The timestamp when sending is allowed again can be obtained via the SentPacketHandler.TimeUntilSend.
	SendPacingLimited
	// SendAny means that any packet should be sent
	SendAny
)

func (SendMode) String

func (s SendMode) String() string

type SentPacketHandler

type SentPacketHandler interface {
	// SentPacket may modify the packet
	SentPacket(t monotime.Time, pn, largestAcked protocol.PacketNumber, streamFrames []StreamFrame, frames []Frame, encLevel protocol.EncryptionLevel, ecn protocol.ECN, size protocol.ByteCount, isPathMTUProbePacket, isPathProbePacket bool)
	// ReceivedAck processes an ACK frame.
	// It does not store a copy of the frame.
	ReceivedAck(f *wire.AckFrame, encLevel protocol.EncryptionLevel, rcvTime monotime.Time) (bool, error)
	ReceivedPacket(protocol.EncryptionLevel, monotime.Time)
	ReceivedBytes(_ protocol.ByteCount, rcvTime monotime.Time)
	DropPackets(_ protocol.EncryptionLevel, rcvTime monotime.Time)
	ResetForRetry(rcvTime monotime.Time)

	// The SendMode determines if and what kind of packets can be sent.
	SendMode(now monotime.Time) SendMode
	// TimeUntilSend is the time when the next packet should be sent.
	// It is used for pacing packets.
	TimeUntilSend() monotime.Time
	SetMaxDatagramSize(count protocol.ByteCount)

	// only to be called once the handshake is complete
	QueueProbePacket(protocol.EncryptionLevel) bool /* was a packet queued */

	ECNMode(isShortHeaderPacket bool) protocol.ECN // isShortHeaderPacket should only be true for non-coalesced 1-RTT packets
	PeekPacketNumber(protocol.EncryptionLevel) (protocol.PacketNumber, protocol.PacketNumberLen)
	PopPacketNumber(protocol.EncryptionLevel) protocol.PacketNumber

	GetLossDetectionTimeout() monotime.Time
	OnLossDetectionTimeout(now monotime.Time) error

	MigratedPath(now monotime.Time, initialMaxPacketSize protocol.ByteCount)
}

SentPacketHandler handles ACKs received for outgoing packets

func NewAckHandler

func NewAckHandler(
	initialPacketNumber protocol.PacketNumber,
	initialMaxDatagramSize protocol.ByteCount,
	rttStats *utils.RTTStats,
	connStats *utils.ConnectionStats,
	clientAddressValidated bool,
	enableECN bool,
	ignorePacketsBelow func(protocol.PacketNumber),
	pers protocol.Perspective,
	qlogger qlogwriter.Recorder,
	logger utils.Logger,
) SentPacketHandler

NewAckHandler creates a new SentPacketHandler and a new ReceivedPacketHandler. clientAddressValidated indicates whether the address was validated beforehand by an address validation token. clientAddressValidated has no effect for a client.

func NewSentPacketHandler

func NewSentPacketHandler(
	initialPN protocol.PacketNumber,
	initialMaxDatagramSize protocol.ByteCount,
	rttStats *utils.RTTStats,
	connStats *utils.ConnectionStats,
	clientAddressValidated bool,
	enableECN bool,
	ignorePacketsBelow func(protocol.PacketNumber),
	pers protocol.Perspective,
	qlogger qlogwriter.Recorder,
	logger utils.Logger,
) SentPacketHandler

clientAddressValidated indicates whether the address was validated beforehand by an address validation token. If the address was validated, the amplification limit doesn't apply. It has no effect for a client.

func NewUAckHandler

func NewUAckHandler(
	initialPacketNumber protocol.PacketNumber,
	initialMaxDatagramSize protocol.ByteCount,
	rttStats *utils.RTTStats,
	connStats *utils.ConnectionStats,
	clientAddressValidated bool,
	enableECN bool,
	ignorePacketsBelow func(protocol.PacketNumber),
	pers protocol.Perspective,
	qlogger qlogwriter.Recorder,
	logger utils.Logger,
) SentPacketHandler

[UQUIC] NewUAckHandler creates a uSentPacketHandler that allows controlling the Initial packet number length. It only returns the SentPacketHandler; ReceivedPacketHandler is initialized separately by preSetup() in the connection struct.

type StreamFrame

type StreamFrame struct {
	Frame   *wire.StreamFrame
	Handler FrameHandler
}

Jump to

Keyboard shortcuts

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