github.com/psiphon-labs/psiphon-tunnel-core@v2.0.28+incompatible/psiphon/common/quic/gquic-go/internal/ackhandler/interfaces.go (about) 1 package ackhandler 2 3 import ( 4 "time" 5 6 "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/quic/gquic-go/internal/protocol" 7 "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/quic/gquic-go/internal/wire" 8 ) 9 10 // SentPacketHandler handles ACKs received for outgoing packets 11 type SentPacketHandler interface { 12 // SentPacket may modify the packet 13 SentPacket(packet *Packet) 14 SentPacketsAsRetransmission(packets []*Packet, retransmissionOf protocol.PacketNumber) 15 ReceivedAck(ackFrame *wire.AckFrame, withPacketNumber protocol.PacketNumber, encLevel protocol.EncryptionLevel, recvTime time.Time) error 16 SetHandshakeComplete() 17 18 // The SendMode determines if and what kind of packets can be sent. 19 SendMode() SendMode 20 // TimeUntilSend is the time when the next packet should be sent. 21 // It is used for pacing packets. 22 TimeUntilSend() time.Time 23 // ShouldSendNumPackets returns the number of packets that should be sent immediately. 24 // It always returns a number greater or equal than 1. 25 // A number greater than 1 is returned when the pacing delay is smaller than the minimum pacing delay. 26 // Note that the number of packets is only calculated based on the pacing algorithm. 27 // Before sending any packet, SendingAllowed() must be called to learn if we can actually send it. 28 ShouldSendNumPackets() int 29 30 GetStopWaitingFrame(force bool) *wire.StopWaitingFrame 31 GetLowestPacketNotConfirmedAcked() protocol.PacketNumber 32 DequeuePacketForRetransmission() *Packet 33 DequeueProbePacket() (*Packet, error) 34 GetPacketNumberLen(protocol.PacketNumber) protocol.PacketNumberLen 35 36 GetAlarmTimeout() time.Time 37 OnAlarm() error 38 } 39 40 // ReceivedPacketHandler handles ACKs needed to send for incoming packets 41 type ReceivedPacketHandler interface { 42 ReceivedPacket(packetNumber protocol.PacketNumber, rcvTime time.Time, shouldInstigateAck bool) error 43 IgnoreBelow(protocol.PacketNumber) 44 45 GetAlarmTimeout() time.Time 46 GetAckFrame() *wire.AckFrame 47 }