Documentation
¶
Index ¶
- Constants
- type AIMDCongestionWindow
- type CUBICCongestionWindow
- func (cw *CUBICCongestionWindow) CubicUpdate()
- func (cw *CUBICCongestionWindow) DecreaseWindow()
- func (cw *CUBICCongestionWindow) HandleSignal(signal CongestionSignal)
- func (cw *CUBICCongestionWindow) IncreaseWindow()
- func (cw *CUBICCongestionWindow) Size() int
- func (cw *CUBICCongestionWindow) String() string
- type CongestionSignal
- type CongestionWindow
- type FixedCongestionWindow
- type RTTEstimator
Constants ¶
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
Constructs a new AIMD congestion control window with the specified initial window size, defaulting to maximum slow start threshold, standard AI/MD coefficients, and other predefined behavior.
func (*AIMDCongestionWindow) DecreaseWindow ¶
func (cw *AIMDCongestionWindow) DecreaseWindow()
Decreases the congestion window using a multiplicative decrease factor, setting the new window size to either the calculated slow start threshold or the initial window size based on the reset flag.
func (*AIMDCongestionWindow) HandleSignal ¶
func (cw *AIMDCongestionWindow) HandleSignal(signal CongestionSignal)
Handles congestion signals by increasing the congestion window on successful data delivery (`SigData`) and decreasing it on packet loss or network congestion (`SigLoss`, `SigCongest`).
func (*AIMDCongestionWindow) IncreaseWindow ¶
func (cw *AIMDCongestionWindow) IncreaseWindow()
Increases the congestion window additively during slow start (when below the threshold) and conservatively during congestion avoidance (when above the threshold) to manage network load.
func (*AIMDCongestionWindow) Size ¶
func (cw *AIMDCongestionWindow) Size() int
Returns the current congestion window size as an integer, using a read lock to ensure thread-safe access to the window value.
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()
Decreases the congestion window after detecting packet loss, applying CUBIC's multiplicative decrease and faster convergence logic to adjust window size and thresholds for efficient network congestion control.
func (*CUBICCongestionWindow) HandleSignal ¶
func (cw *CUBICCongestionWindow) HandleSignal(signal CongestionSignal)
Handles congestion signals by adjusting the congestion window size: increases the window upon receiving a data signal (SigData) and decreases it upon detecting packet loss (SigLoss) or network congestion (SigCongest).
func (*CUBICCongestionWindow) IncreaseWindow ¶
func (cw *CUBICCongestionWindow) IncreaseWindow()
Increments the congestion window using CUBIC's algorithm, applying fast growth during slow start (when window < ssthresh) or cubic-based adjustment during congestion avoidance, ensuring thread-safety with a mutex.
func (*CUBICCongestionWindow) Size ¶
func (cw *CUBICCongestionWindow) Size() int
Returns the current congestion window size as an integer, safely read using a read lock to prevent race conditions in concurrent environments.
func (*CUBICCongestionWindow) String ¶
func (cw *CUBICCongestionWindow) String() string
Implements the fmt.Stringer interface by returning the identifier string "cubic-congestion-window" for this congestion control algorithm type.
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
Constructs a new FixedCongestionWindow with the specified congestion window size.
func (*FixedCongestionWindow) DecreaseWindow ¶
func (cw *FixedCongestionWindow) DecreaseWindow()
This method is intended to decrease the congestion window size, but has no effect as the window size is fixed.
func (*FixedCongestionWindow) HandleSignal ¶
func (cw *FixedCongestionWindow) HandleSignal(signal CongestionSignal)
Handles congestion signals by taking no action, as the fixed congestion window size remains constant regardless of network conditions.
func (*FixedCongestionWindow) IncreaseWindow ¶
func (cw *FixedCongestionWindow) IncreaseWindow()
No-ops (does nothing) because the congestion window size is fixed and cannot be increased.
func (*FixedCongestionWindow) Size ¶
func (cw *FixedCongestionWindow) Size() int
Returns the current size of the fixed congestion window as an integer.
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.