Documentation
¶
Index ¶
- Constants
- func AckProbeNeeded(handler SentPacketHandler, now monotime.Time, policy func(AckProbeInfo) bool) bool
- func HasAckElicitingFrames(fs []Frame) bool
- func IsFrameAckEliciting(f wire.Frame) bool
- func IsFrameTypeAckEliciting(t wire.FrameType) bool
- func SetPacketNumberLengthPolicy(handler SentPacketHandler, policy func(PacketNumberLengthInfo) uint8)
- type AckECNMode
- type AckPolicy
- type AckProbeInfo
- type AckReorderingMode
- type Frame
- type FrameHandler
- type PacketNumberLengthInfo
- type ReceivedPacketHandler
- func (h *ReceivedPacketHandler) DropPackets(encLevel protocol.EncryptionLevel)
- func (h *ReceivedPacketHandler) GetAckFrame(encLevel protocol.EncryptionLevel, now monotime.Time, onlyIfQueued bool) *wire.AckFrame
- func (h *ReceivedPacketHandler) GetAlarmTimeout() monotime.Time
- func (h *ReceivedPacketHandler) HandleLegacyAckFrequency(f *wire.LegacyAckFrequencyFrame) error
- func (h *ReceivedPacketHandler) IgnorePacketsBelow(pn protocol.PacketNumber)
- func (h *ReceivedPacketHandler) IsPotentiallyDuplicate(pn protocol.PacketNumber, space protocol.PacketNumberSpace) bool
- func (h *ReceivedPacketHandler) ReceivedPacket(pn protocol.PacketNumber, ecn protocol.ECN, encLevel protocol.EncryptionLevel, ...) error
- func (h *ReceivedPacketHandler) SetAckPolicy(policy *AckPolicy, rtt *utils.RTTStats)
- func (h *ReceivedPacketHandler) SetLegacyAckFrequency(minimum time.Duration)
- func (h *ReceivedPacketHandler) SetMaxAckDelay(delay time.Duration)
- type SendMode
- type SentPacketHandler
- type StreamFrame
Constants ¶
const MaxAckDelay = 25 * time.Millisecond
MaxAckDelay is the maximum time by which we delay sending ACKs.
Variables ¶
This section is empty.
Functions ¶
func AckProbeNeeded ¶ added in v1.0.6
func AckProbeNeeded(handler SentPacketHandler, now monotime.Time, policy func(AckProbeInfo) bool) bool
AckProbeNeeded evaluates a client policy only when an application-data ACK is being built. It never creates an independent timer or changes PTO recovery.
func HasAckElicitingFrames ¶
HasAckElicitingFrames returns true if at least one frame is ack-eliciting.
func IsFrameAckEliciting ¶
IsFrameAckEliciting returns true if the frame is ack-eliciting.
func IsFrameTypeAckEliciting ¶
IsFrameTypeAckEliciting returns true if the frame is ack-eliciting.
func SetPacketNumberLengthPolicy ¶ added in v1.0.6
func SetPacketNumberLengthPolicy(handler SentPacketHandler, policy func(PacketNumberLengthInfo) uint8)
SetPacketNumberLengthPolicy installs a client-only policy without extending the native handler interface. Callbacks run in the send loop and must not block or reenter the connection. Invalid results fall back to the native length.
Types ¶
type AckECNMode ¶ added in v1.0.3
type AckECNMode uint8
const ( AckECNNative AckECNMode = iota AckECNTransitions AckECNCountOnly )
type AckPolicy ¶ added in v1.0.3
type AckPolicy struct {
// PacketThreshold is the initial ack-eliciting packet threshold; zero uses native.
PacketThreshold uint64
// DecimationThreshold, when nonzero, replaces PacketThreshold after a packet
// number reaches the smallest received number plus DecimationAfter. This is
// a packet-number span, not a count of received or ack-eliciting packets.
DecimationThreshold uint64
DecimationAfter uint64
// RTTDivisor bounds delay by minRTT/divisor after the decimation span is
// reached. Zero disables this bound. MinDelay supplies a timer floor.
RTTDivisor uint32
MinDelay time.Duration
Reordering AckReorderingMode
MissingPacketAckLimit uint64
ECN AckECNMode
}
AckPolicy configures local Application Data acknowledgments. Nil preserves native behavior. It neither negotiates ACK_FREQUENCY nor changes peer ACKs. A configured policy keeps the earliest pending deadline rather than sliding it.
type AckProbeInfo ¶ added in v1.0.6
type AckProbeInfo struct {
OutstandingPackets uint64
HasLastAckEliciting bool
SinceLastAckEliciting time.Duration
PTO time.Duration
}
AckProbeInfo describes tracked application-data packets, including ACK-only packets, and time since the last ACK-eliciting send. PTO excludes backoff.
type AckReorderingMode ¶ added in v1.0.3
type AckReorderingMode uint8
AckReorderingMode selects when packet gaps prompt an immediate ACK.
const ( AckReorderingNative AckReorderingMode = iota // AckReorderingImmediate acknowledges every out-of-order ack-eliciting packet. AckReorderingImmediate // AckReorderingWindow acknowledges the first MissingPacketAckLimit packets // following a gap, and packets filling gaps already reported to the peer. AckReorderingWindow )
type Frame ¶
type Frame struct {
Frame wire.Frame // nil if the frame has already been acknowledged in another packet
Handler FrameHandler
}
type FrameHandler ¶
FrameHandler handles the acknowledgement and the loss of a frame.
type PacketNumberLengthInfo ¶ added in v1.0.6
type PacketNumberLengthInfo struct {
PacketNumber uint64
LargestAcknowledged int64
LeastUnacknowledged uint64
MaxPacketsInFlight uint64
NativeLength uint8
}
PacketNumberLengthInfo is a send-loop snapshot for choosing 1..4 encoded bytes. LargestAcknowledged is -1 before the first ACK in this number space. LeastUnacknowledged includes tracked ACK-only packets. MaxPacketsInFlight estimates the congestion window in full-size datagrams.
type ReceivedPacketHandler ¶
type ReceivedPacketHandler struct {
// contains filtered or unexported fields
}
func NewReceivedPacketHandler ¶
func NewReceivedPacketHandler(logger utils.Logger) *ReceivedPacketHandler
func (*ReceivedPacketHandler) DropPackets ¶
func (h *ReceivedPacketHandler) DropPackets(encLevel protocol.EncryptionLevel)
func (*ReceivedPacketHandler) GetAckFrame ¶
func (h *ReceivedPacketHandler) GetAckFrame(encLevel protocol.EncryptionLevel, now monotime.Time, onlyIfQueued bool) *wire.AckFrame
func (*ReceivedPacketHandler) GetAlarmTimeout ¶
func (h *ReceivedPacketHandler) GetAlarmTimeout() monotime.Time
func (*ReceivedPacketHandler) HandleLegacyAckFrequency ¶ added in v1.0.7
func (h *ReceivedPacketHandler) HandleLegacyAckFrequency(f *wire.LegacyAckFrequencyFrame) error
func (*ReceivedPacketHandler) IgnorePacketsBelow ¶
func (h *ReceivedPacketHandler) IgnorePacketsBelow(pn protocol.PacketNumber)
func (*ReceivedPacketHandler) IsPotentiallyDuplicate ¶
func (h *ReceivedPacketHandler) IsPotentiallyDuplicate(pn protocol.PacketNumber, space protocol.PacketNumberSpace) bool
func (*ReceivedPacketHandler) ReceivedPacket ¶
func (h *ReceivedPacketHandler) ReceivedPacket( pn protocol.PacketNumber, ecn protocol.ECN, encLevel protocol.EncryptionLevel, rcvTime monotime.Time, ackEliciting bool, ) error
func (*ReceivedPacketHandler) SetAckPolicy ¶ added in v1.0.3
func (h *ReceivedPacketHandler) SetAckPolicy(policy *AckPolicy, rtt *utils.RTTStats)
SetAckPolicy snapshots receive policy before packets arrive. Initial and Handshake trackers are deliberately independent of this configuration.
func (*ReceivedPacketHandler) SetLegacyAckFrequency ¶ added in v1.0.7
func (h *ReceivedPacketHandler) SetLegacyAckFrequency(minimum time.Duration)
SetLegacyAckFrequency enables only the negotiated legacy receive format. Initial/Handshake ACKs and default scheduling before an update stay unchanged.
func (*ReceivedPacketHandler) SetMaxAckDelay ¶
func (h *ReceivedPacketHandler) SetMaxAckDelay(delay time.Duration)
SetMaxAckDelay configures the advertised bound before packets are received.
type SendMode ¶
type SendMode uint8
The SendMode says what kind of packets can be sent.
const ( // SendNone means that no packets should be sent SendNone SendMode = iota // SendAck means an ACK-only packet should be sent SendAck // SendPTOInitial means that an Initial probe packet should be sent SendPTOInitial // SendPTOHandshake means that a Handshake probe packet should be sent SendPTOHandshake // SendPTOAppData means that an Application data probe packet should be sent SendPTOAppData // SendPacingLimited means that the pacer doesn't allow sending of a packet right now, // but will do in a little while. // The timestamp when sending is allowed again can be obtained via the SentPacketHandler.TimeUntilSend. SendPacingLimited // SendAny means that any packet should be sent SendAny )
type SentPacketHandler ¶
type SentPacketHandler interface {
// SentPacket may modify the packet
SentPacket(t monotime.Time, pn, largestAcked protocol.PacketNumber, streamFrames []StreamFrame, frames []Frame, encLevel protocol.EncryptionLevel, ecn protocol.ECN, size protocol.ByteCount, isPathMTUProbePacket, isPathProbePacket bool)
// ReceivedAck processes an ACK frame.
// It does not store a copy of the frame.
ReceivedAck(f *wire.AckFrame, encLevel protocol.EncryptionLevel, rcvTime monotime.Time) (bool, error)
ReceivedPacket(protocol.EncryptionLevel, monotime.Time)
ReceivedBytes(_ protocol.ByteCount, rcvTime monotime.Time)
DropPackets(_ protocol.EncryptionLevel, rcvTime monotime.Time)
ResetForRetry(rcvTime monotime.Time)
// The SendMode determines if and what kind of packets can be sent.
SendMode(now monotime.Time) SendMode
// TimeUntilSend is the time when the next packet should be sent.
// It is used for pacing packets.
TimeUntilSend() monotime.Time
SetMaxDatagramSize(count protocol.ByteCount)
AckFrequencyState() (window, packetSize protocol.ByteCount)
SetPeerMaxAckDelay(time.Duration, monotime.Time)
// only to be called once the handshake is complete
QueueProbePacket(protocol.PacketNumberSpace) bool /* was a packet queued */
ECNMode(isShortHeaderPacket bool) protocol.ECN // isShortHeaderPacket should only be true for non-coalesced 1-RTT packets
PeekPacketNumber(protocol.PacketNumberSpace) (protocol.PacketNumber, protocol.PacketNumberLen)
PopPacketNumber(protocol.PacketNumberSpace) protocol.PacketNumber
GetLossDetectionTimeout() monotime.Time
OnLossDetectionTimeout(now monotime.Time) error
MigratedPath(now monotime.Time, initialMaxPacketSize protocol.ByteCount)
}
SentPacketHandler handles ACKs received for outgoing packets
func NewSentPacketHandler ¶
func NewSentPacketHandler( initialPN protocol.PacketNumber, initialMaxDatagramSize protocol.ByteCount, rttStats *utils.RTTStats, connStats *utils.ConnectionStats, clientAddressValidated bool, enableECN bool, ignorePacketsBelow func(protocol.PacketNumber), pers protocol.Perspective, qlogger qlogwriter.Recorder, logger utils.Logger, initialWindowPackets ...uint32, ) SentPacketHandler
clientAddressValidated indicates whether the address was validated beforehand by an address validation token. If the address was validated, the amplification limit doesn't apply. It has no effect for a client.
type StreamFrame ¶
type StreamFrame struct {
Frame *wire.StreamFrame
Handler FrameHandler
}
Source Files
¶
- ack_eliciting.go
- ack_policy.go
- client_packet_policy.go
- ecn.go
- frame.go
- interfaces.go
- legacy_ack_frequency.go
- lost_packet_tracker.go
- packet.go
- packet_number_generator.go
- receive_config.go
- received_packet_handler.go
- received_packet_history.go
- received_packet_tracker.go
- send_mode.go
- sent_packet_handler.go
- sent_packet_history.go