github.com/psiphon-labs/psiphon-tunnel-core@v2.0.28+incompatible/psiphon/common/quic/gquic-go/internal/congestion/interface.go (about)

     1  package congestion
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/quic/gquic-go/internal/protocol"
     7  )
     8  
     9  // A SendAlgorithm performs congestion control and calculates the congestion window
    10  type SendAlgorithm interface {
    11  	TimeUntilSend(bytesInFlight protocol.ByteCount) time.Duration
    12  	OnPacketSent(sentTime time.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool)
    13  	GetCongestionWindow() protocol.ByteCount
    14  	MaybeExitSlowStart()
    15  	OnPacketAcked(number protocol.PacketNumber, ackedBytes protocol.ByteCount, priorInFlight protocol.ByteCount, eventTime time.Time)
    16  	OnPacketLost(number protocol.PacketNumber, lostBytes protocol.ByteCount, priorInFlight protocol.ByteCount)
    17  	SetNumEmulatedConnections(n int)
    18  	OnRetransmissionTimeout(packetsRetransmitted bool)
    19  	OnConnectionMigration()
    20  
    21  	// Experiments
    22  	SetSlowStartLargeReduction(enabled bool)
    23  }
    24  
    25  // SendAlgorithmWithDebugInfo adds some debug functions to SendAlgorithm
    26  type SendAlgorithmWithDebugInfo interface {
    27  	SendAlgorithm
    28  	BandwidthEstimate() Bandwidth
    29  
    30  	// Stuff only used in testing
    31  
    32  	HybridSlowStart() *HybridSlowStart
    33  	SlowstartThreshold() protocol.ByteCount
    34  	RenoBeta() float32
    35  	InRecovery() bool
    36  }