interface.go 1.2 KB

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