Documentation
¶
Index ¶
- Constants
- func ConfigControlSocketLocation() string
- func ConfigLogBackendLocation() string
- func ConfigLogName() string
- func ConfigSamplingRate() time.Duration
- func NewCubicSender(clock Clock, rttStats *utils.RTTStats, ...) *cubicSender
- func NewOpenLoopSender(clock Clock, rttStats *utils.RTTStats, ...) *openLoopSender
- func PrintAfter10Sec(cl ConnectionLogger)
- func StartPeriodicLogHook(periodicLogHook func(), period time.Duration)
- type Bandwidth
- type Clock
- type CongestionType
- type ConnectionLogger
- type ConnectionLoggerMemory
- func (cl *ConnectionLoggerMemory) EnsureKeyInit(key string)
- func (cl *ConnectionLoggerMemory) InitKey(key string)
- func (cl *ConnectionLoggerMemory) LogEvent(time time.Time, eventName string)
- func (cl *ConnectionLoggerMemory) LogInt64(time time.Time, key string, value int64)
- func (cl *ConnectionLoggerMemory) LogString(time time.Time, key string, value string)
- func (cl ConnectionLoggerMemory) String() string
- type ConnectionLoggerRemote
- type ControlAction
- type Cubic
- func (c *Cubic) CongestionWindowAfterAck(ackedBytes protocol.ByteCount, currentCongestionWindow protocol.ByteCount, ...) protocol.ByteCount
- func (c *Cubic) CongestionWindowAfterPacketLoss(currentCongestionWindow protocol.ByteCount) protocol.ByteCount
- func (c *Cubic) OnApplicationLimited()
- func (c *Cubic) Reset()
- func (c *Cubic) SetNumConnections(n int)
- type DefaultClock
- type HybridSlowStart
- func (s *HybridSlowStart) IsEndOfRound(ack protocol.PacketNumber) bool
- func (s *HybridSlowStart) OnPacketAcked(ackedPacketNumber protocol.PacketNumber)
- func (s *HybridSlowStart) OnPacketSent(packetNumber protocol.PacketNumber)
- func (s *HybridSlowStart) Restart()
- func (s *HybridSlowStart) ShouldExitSlowStart(latestRTT time.Duration, minRTT time.Duration, ...) bool
- func (s *HybridSlowStart) StartReceiveRound(lastSent protocol.PacketNumber)
- func (s *HybridSlowStart) Started() bool
- type LogBackend
- type LogEntry
- type LogEntrySeries
- type LogEntryValueType
- type OpenLoopController
- type RemoteLogEntry
- type SendAlgorithm
- type SendAlgorithmWithDebugInfos
Constants ¶
const ( // BitsPerSecond is 1 bit per second BitsPerSecond Bandwidth = 1 // BytesPerSecond is 1 byte per second BytesPerSecond = 8 * BitsPerSecond KiloBitsPerSecond = factor * BitsPerSecond KiloBytesPerSecond = factor * BytesPerSecond MegaBitsPerSecond = factor * KiloBitsPerSecond MegaBytesPerSecond = factor * KiloBytesPerSecond GigaBytesPerSecond = factor * MegaBytesPerSecond )
Variables ¶
This section is empty.
Functions ¶
func NewCubicSender ¶
func NewCubicSender( clock Clock, rttStats *utils.RTTStats, initialMaxDatagramSize protocol.ByteCount, reno bool, tracer logging.ConnectionTracer, ) *cubicSender
NewCubicSender makes a new cubic sender
func NewOpenLoopSender ¶
func NewOpenLoopSender( clock Clock, rttStats *utils.RTTStats, openLoopInitialMaxDatagramSize protocol.ByteCount, ) *openLoopSender
NewOpenLoopSender makes a new cubic sender
func PrintAfter10Sec ¶
func PrintAfter10Sec(cl ConnectionLogger)
Types ¶
type Bandwidth ¶
type Bandwidth uint64
Bandwidth of a connection
func BandwidthFromDelta ¶
BandwidthFromDelta calculates the bandwidth from a number of bytes and a time delta
type CongestionType ¶
type CongestionType string
const ( CongestionTypeCubic CongestionType = "Cubic" CongestionTypeReno CongestionType = "Reno" CongestionTypeOpenLoop CongestionType = "Open-Loop" )
type ConnectionLogger ¶
type ConnectionLogger interface { LogString(time time.Time, key string, value string) LogInt64(time time.Time, key string, value int64) LogEvent(time time.Time, eventName string) String() string }
func NewConnectionLogger ¶
func NewConnectionLogger() ConnectionLogger
type ConnectionLoggerMemory ¶
type ConnectionLoggerMemory struct {
LogStorage map[string]*LogEntrySeries
}
func (*ConnectionLoggerMemory) EnsureKeyInit ¶
func (cl *ConnectionLoggerMemory) EnsureKeyInit(key string)
func (*ConnectionLoggerMemory) InitKey ¶
func (cl *ConnectionLoggerMemory) InitKey(key string)
func (*ConnectionLoggerMemory) LogEvent ¶
func (cl *ConnectionLoggerMemory) LogEvent(time time.Time, eventName string)
func (*ConnectionLoggerMemory) LogInt64 ¶
func (cl *ConnectionLoggerMemory) LogInt64(time time.Time, key string, value int64)
func (*ConnectionLoggerMemory) LogString ¶
func (cl *ConnectionLoggerMemory) LogString(time time.Time, key string, value string)
func (ConnectionLoggerMemory) String ¶
func (cl ConnectionLoggerMemory) String() string
type ConnectionLoggerRemote ¶
type ConnectionLoggerRemote struct {
// contains filtered or unexported fields
}
func (*ConnectionLoggerRemote) LogEvent ¶
func (cl *ConnectionLoggerRemote) LogEvent(time time.Time, eventName string)
func (*ConnectionLoggerRemote) LogInt64 ¶
func (cl *ConnectionLoggerRemote) LogInt64(time time.Time, key string, value int64)
func (*ConnectionLoggerRemote) LogString ¶
func (cl *ConnectionLoggerRemote) LogString(time time.Time, key string, value string)
func (ConnectionLoggerRemote) String ¶
func (cl ConnectionLoggerRemote) String() string
type ControlAction ¶
type Cubic ¶
type Cubic struct {
// contains filtered or unexported fields
}
Cubic implements the cubic algorithm from TCP
func (*Cubic) CongestionWindowAfterAck ¶
func (c *Cubic) CongestionWindowAfterAck( ackedBytes protocol.ByteCount, currentCongestionWindow protocol.ByteCount, delayMin time.Duration, eventTime time.Time, ) protocol.ByteCount
CongestionWindowAfterAck computes a new congestion window to use after a received ACK. Returns the new congestion window in packets. The new congestion window follows a cubic function that depends on the time passed since last packet loss.
func (*Cubic) CongestionWindowAfterPacketLoss ¶
func (c *Cubic) CongestionWindowAfterPacketLoss(currentCongestionWindow protocol.ByteCount) protocol.ByteCount
CongestionWindowAfterPacketLoss computes a new congestion window to use after a loss event. Returns the new congestion window in packets. The new congestion window is a multiplicative decrease of our current window.
func (*Cubic) OnApplicationLimited ¶
func (c *Cubic) OnApplicationLimited()
OnApplicationLimited is called on ack arrival when sender is unable to use the available congestion window. Resets Cubic state during quiescence.
type DefaultClock ¶
type DefaultClock struct{}
DefaultClock implements the Clock interface using the Go stdlib clock.
type HybridSlowStart ¶
type HybridSlowStart struct {
// contains filtered or unexported fields
}
HybridSlowStart implements the TCP hybrid slow start algorithm
func (*HybridSlowStart) IsEndOfRound ¶
func (s *HybridSlowStart) IsEndOfRound(ack protocol.PacketNumber) bool
IsEndOfRound returns true if this ack is the last packet number of our current slow start round.
func (*HybridSlowStart) OnPacketAcked ¶
func (s *HybridSlowStart) OnPacketAcked(ackedPacketNumber protocol.PacketNumber)
OnPacketAcked gets invoked after ShouldExitSlowStart, so it's best to end the round when the final packet of the burst is received and start it on the next incoming ack.
func (*HybridSlowStart) OnPacketSent ¶
func (s *HybridSlowStart) OnPacketSent(packetNumber protocol.PacketNumber)
OnPacketSent is called when a packet was sent
func (*HybridSlowStart) ShouldExitSlowStart ¶
func (s *HybridSlowStart) ShouldExitSlowStart(latestRTT time.Duration, minRTT time.Duration, congestionWindow protocol.ByteCount) bool
ShouldExitSlowStart should be called on every new ack frame, since a new RTT measurement can be made then. rtt: the RTT for this ack packet. minRTT: is the lowest delay (RTT) we have seen during the session. congestionWindow: the congestion window in packets.
func (*HybridSlowStart) StartReceiveRound ¶
func (s *HybridSlowStart) StartReceiveRound(lastSent protocol.PacketNumber)
StartReceiveRound is called for the start of each receive round (burst) in the slow start phase.
func (*HybridSlowStart) Started ¶
func (s *HybridSlowStart) Started() bool
Started returns true if started
type LogBackend ¶
type LogBackend string
const ( LogBackendMemory LogBackend = "Memory" LogBackendRemote LogBackend = "Socket" )
func ConfigLogBackend ¶
func ConfigLogBackend() LogBackend
type LogEntry ¶
type LogEntry struct { EventTime time.Time Type LogEntryValueType Value string }
type LogEntrySeries ¶
type LogEntrySeries struct {
LogEntries []LogEntry
}
func (*LogEntrySeries) Append ¶
func (logSeries *LogEntrySeries) Append(entry LogEntry)
func (*LogEntrySeries) String ¶
func (logSeries *LogEntrySeries) String() string
type LogEntryValueType ¶
type LogEntryValueType string
const ( LogEntryTypeString LogEntryValueType = "string" LogEntryTypeInt64 LogEntryValueType = "int64" LogEntryTypeEvent LogEntryValueType = "event" )
type OpenLoopController ¶
type OpenLoopController struct { SetCwndFunction func(int64) SetMaxSendingRate func(Bandwidth) // contains filtered or unexported fields }
func NewOpenLoopController ¶
func NewOpenLoopController(setCwndFunc func(int64), setMaxSendingRate func(Bandwidth)) *OpenLoopController
func (*OpenLoopController) Close ¶
func (o *OpenLoopController) Close() error
type RemoteLogEntry ¶
type RemoteLogEntry struct { ConnectionName string Key string EventTime int64 Type LogEntryValueType Value string }
type SendAlgorithm ¶
type SendAlgorithm interface { TimeUntilSend(bytesInFlight protocol.ByteCount) time.Time HasPacingBudget() bool OnPacketSent(sentTime time.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool) CanSend(bytesInFlight protocol.ByteCount) bool MaybeExitSlowStart() OnPacketAcked(number protocol.PacketNumber, ackedBytes protocol.ByteCount, priorInFlight protocol.ByteCount, eventTime time.Time) OnPacketLost(number protocol.PacketNumber, lostBytes protocol.ByteCount, priorInFlight protocol.ByteCount) OnRetransmissionTimeout(packetsRetransmitted bool) SetMaxDatagramSize(protocol.ByteCount) }
A SendAlgorithm performs congestion control