congestion

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SigData    = iota // data is fetched
	SigLoss           // data loss detected
	SigCongest        // congestion detected (e.g. NACK with a reason of congestion)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AIMDCongestionWindow

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

AIMDCongestionControl is an implementation of CongestionWindow using Additive Increase Multiplicative Decrease algorithm

func NewAIMDCongestionWindow

func NewAIMDCongestionWindow(cwnd int) *AIMDCongestionWindow

(AI GENERATED DESCRIPTION): Creates a new AIMD congestion‑window instance initialized with the specified cwnd value and default parameters for slow‑start threshold, additive increase step, multiplicative decrease coefficient, etc.

func (*AIMDCongestionWindow) DecreaseWindow

func (cw *AIMDCongestionWindow) DecreaseWindow()

(AI GENERATED DESCRIPTION): Decreases the congestion window size by computing a new slow‑start threshold using a multiplicative‑decrease coefficient (bounded by a minimum value) and then setting the window to either that threshold or the initial window if a reset flag is set.

func (*AIMDCongestionWindow) HandleSignal

func (cw *AIMDCongestionWindow) HandleSignal(signal CongestionSignal)

(AI GENERATED DESCRIPTION): Handles congestion signals by increasing the AIMD window on SigData, decreasing it on SigLoss or SigCongest, and leaving it unchanged for other signals.

func (*AIMDCongestionWindow) IncreaseWindow

func (cw *AIMDCongestionWindow) IncreaseWindow()

(AI GENERATED DESCRIPTION): Increments the congestion window size using AIMD: adds a fixed step when below the slow‑start threshold and a fractional step proportional to 1/window when above it, while protecting the update with a mutex.

func (*AIMDCongestionWindow) Size

func (cw *AIMDCongestionWindow) Size() int

(AI GENERATED DESCRIPTION): Returns the current size (in packets) of the AIMD congestion window.

func (*AIMDCongestionWindow) String

func (cw *AIMDCongestionWindow) String() string

log identifier

type CUBICCongestionWindow

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

CUBICCongestionWindow is an implementation of CongestionWindow using CUBIC algorithm ref: https://tools.ietf.org/html/rfc8312

func NewCUBICCongestionWindow

func NewCUBICCongestionWindow(cwnd int, rttEstimator *RTTEstimator) *CUBICCongestionWindow

NewCUBICCongestionWindow creates a new CUBICCongestionWindow. rttEstimator is the RTT estimator to use, or nil if not available.

func (*CUBICCongestionWindow) CubicUpdate

func (cw *CUBICCongestionWindow) CubicUpdate()

Cubic update algorithm

func (*CUBICCongestionWindow) DecreaseWindow

func (cw *CUBICCongestionWindow) DecreaseWindow()

(AI GENERATED DESCRIPTION): Decreases the congestion window and slow‑start threshold using a multiplicative‑decrease rule, updates the window maximum for fast convergence if enabled, and records the time of the last reduction.

func (*CUBICCongestionWindow) HandleSignal

func (cw *CUBICCongestionWindow) HandleSignal(signal CongestionSignal)

(AI GENERATED DESCRIPTION): Adjusts the congestion window in response to a congestion signal, increasing the window on data reception and decreasing it on loss or congestion indications.

func (*CUBICCongestionWindow) IncreaseWindow

func (cw *CUBICCongestionWindow) IncreaseWindow()

(AI GENERATED DESCRIPTION): Increments the congestion window size: during slow‑start it adds `aiStep` until the threshold `ssthresh`, then invokes `CubicUpdate` for CUBIC congestion‑avoidance.

func (*CUBICCongestionWindow) Size

func (cw *CUBICCongestionWindow) Size() int

(AI GENERATED DESCRIPTION): Retrieves and returns the current congestion window size of the CUBIC congestion controller as an integer.

func (*CUBICCongestionWindow) String

func (cw *CUBICCongestionWindow) String() string

(AI GENERATED DESCRIPTION): Returns the string “cubic-congestion-window” to represent a CUBICCongestionWindow instance.

type CongestionSignal

type CongestionSignal int

CongestionSignal represents signals to adjust the congestion window.

type CongestionWindow

type CongestionWindow interface {
	String() string

	HandleSignal(signal CongestionSignal) // signal handler

	Size() int
	IncreaseWindow()
	DecreaseWindow()
}

CongestionWindow provides an interface for congestion control that manages a window

type FixedCongestionWindow

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

FixedCongestionControl is an implementation of CongestionWindow with a fixed window size that does not change in response to signals or events.

func NewFixedCongestionWindow

func NewFixedCongestionWindow(cwnd int) *FixedCongestionWindow

(AI GENERATED DESCRIPTION): Initializes a FixedCongestionWindow instance with the specified congestion‑window size.

func (*FixedCongestionWindow) DecreaseWindow

func (cw *FixedCongestionWindow) DecreaseWindow()

(AI GENERATED DESCRIPTION): No‑op: the congestion window is fixed, so this method intentionally performs no action when a decrease is requested.

func (*FixedCongestionWindow) HandleSignal

func (cw *FixedCongestionWindow) HandleSignal(signal CongestionSignal)

(AI GENERATED DESCRIPTION): Does nothing in response to congestion signals, keeping the congestion window fixed.

func (*FixedCongestionWindow) IncreaseWindow

func (cw *FixedCongestionWindow) IncreaseWindow()

(AI GENERATED DESCRIPTION): Does nothing – keeps the congestion window size fixed by intentionally not increasing it.

func (*FixedCongestionWindow) Size

func (cw *FixedCongestionWindow) Size() int

(AI GENERATED DESCRIPTION): Returns the current size of the fixed congestion window.

func (*FixedCongestionWindow) String

func (cw *FixedCongestionWindow) String() string

log identifier

type RTTEstimator

type RTTEstimator interface {
	String() string

	EstimatedRTT() time.Duration // get the estimated RTT
	DeviationRTT() time.Duration // get the deviation of RTT

	AddMeasurement(sample time.Duration, retransmitted bool) // add a new RTT measurement
}

RTTEstimator provides an interface for estimating round-trip time.

Jump to

Keyboard shortcuts

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