FrameHandler handles the acknowledgement and the loss of a frame.( FrameHandler) OnAcked(wire.Frame)( FrameHandler) OnLost(wire.Frame)
PathDebugStats is the live per-path recovery snapshot returned by
SentPacketHandler.PathDebugStats. It is test-support state, not part of the
wire protocol. BytesInFlight is pid's current application-data bytes in flight. BytesReceived is the cumulative application-data bytes received on pid. BytesSent is the cumulative application-data bytes sent on pid. CongestionWindow is pid's current congestion window. DistinctController is true when pid's congestion controller and RTT
estimator are both distinct from path 0's and from the connection-level
objects (the Stage 4 risk-#4 gate). It is always false for PathIDZero,
which aliases the connection objects by design. HasRTT reports whether SmoothedRTT is based on a real RTT measurement. LargestAcked is the largest packet number acknowledged in pid's space. LargestSent is the largest packet number sent in pid's own
application-data number space (InvalidPacketNumber if none yet). A value
>= 0 proves a packet was packed and sent for pid specifically. LostBytes is the number of application-data bytes declared lost on pid.
It excludes path validation and path MTU probe packets. LostPackets is the number of application-data packets declared lost on
pid. It excludes path validation and path MTU probe packets. SmoothedRTT is pid's application-data RTT estimate.
func SentPacketHandler.PathDebugStats(pid protocol.PathID) (PathDebugStats, bool)
func github.com/tmc/go-iroh/internal/qng.(*Conn).PathStats(pid protocol.PathID) (PathDebugStats, bool)
AddPath provisions a received-packet tracker for the genuinely-new
application-data path pid (multipath). Each path acknowledges the packets it
receives in its own PATH_ACK number space, so it needs its own tracker. It
mirrors sentPacketHandler.AddPath: pid == PathIDZero or an already-present pid
is a BUG, and it is only ever called once multipath is negotiated.(*ReceivedPacketHandler) DropPackets(encLevel protocol.EncryptionLevel)(*ReceivedPacketHandler) GetAckFrame(encLevel protocol.EncryptionLevel, now monotime.Time, onlyIfQueued bool) *wire.AckFrame GetAckFrameForPath returns the ACK frame for path pid's received packets, to
be carried in a PATH_ACK{pid} frame. For PathIDZero it is identical to
GetAckFrame(Encryption1RTT). An unknown pid returns nil.(*ReceivedPacketHandler) GetAlarmTimeout() monotime.Time GetAlarmTimeoutForPath returns the ACK alarm timeout for path pid's tracker.(*ReceivedPacketHandler) IgnorePacketsBelow(pn protocol.PacketNumber)(*ReceivedPacketHandler) IsPotentiallyDuplicate(pn protocol.PacketNumber, encLevel protocol.EncryptionLevel) bool IsPotentiallyDuplicateForPath reports whether the 1-RTT packet number pn was
already received on path pid. Each non-zero path has its own received-packet
space, so this is checked against pid's tracker, NOT path 0's — path 1's pn=0
is not a duplicate of path 0's pn=0. An unknown pid returns false.(*ReceivedPacketHandler) ReceivedPacket(pn protocol.PacketNumber, ecn protocol.ECN, encLevel protocol.EncryptionLevel, rcvTime monotime.Time, ackEliciting bool) error ReceivedPacketForPath records a 1-RTT packet received on application-data path
pid (multipath), so its acknowledgement is emitted as a PATH_ACK{pid} from
pid's own tracker rather than the connection-level (PathIDZero) ACK. An
unknown pid is a BUG (open the path first). For PathIDZero it is identical to
ReceivedPacket with Encryption1RTT, including the 0-RTT/1-RTT boundary check
(which is connection-global, Stage 4 spec risk #7).(*ReceivedPacketHandler) RemovePath(pid protocol.PathID)
func NewReceivedPacketHandler(logger utils.Logger) *ReceivedPacketHandler
SentPacketHandler handles ACKs received for outgoing packets AddPath provisions a genuinely-new application-data path (pid !=
PathIDZero) with its own RTT estimator and its own congestion controller
(never the connection-level objects PathIDZero aliases). It does not
schedule any send over the path. pid == PathIDZero or an already-present
pid is an error. It is only called once multipath is negotiated.( SentPacketHandler) DropPackets(_ protocol.EncryptionLevel, rcvTime monotime.Time) // isShortHeaderPacket should only be true for non-coalesced 1-RTT packets( SentPacketHandler) GetLossDetectionTimeout() monotime.Time( SentPacketHandler) MigratedPath(now monotime.Time, initialMaxPacketSize protocol.ByteCount)( SentPacketHandler) OnLossDetectionTimeout(now monotime.Time) error PTOCount is the number of consecutive PTOs on the application-data path
since the last acknowledgment. PathDebugStats reports the live application-data recovery state of path
pid. It exists so the multipath end-to-end test can prove, on a real
connection, that a non-zero path genuinely carried packets (LargestSent)
in its own number space and that the path has its own congestion
controller + RTT estimator distinct from path 0 and the connection
(Stage 4 spec risk #4). It must be called from the run goroutine.( SentPacketHandler) PeekPacketNumber(protocol.EncryptionLevel) (protocol.PacketNumber, protocol.PacketNumberLen) PeekPacketNumberForPath / PopPacketNumberForPath operate on the
application-data packet-number space of path pid. For PathIDZero they are
identical to Peek/PopPacketNumber(Encryption1RTT).( SentPacketHandler) PopPacketNumber(protocol.EncryptionLevel) protocol.PacketNumber( SentPacketHandler) PopPacketNumberForPath(pid protocol.PathID) protocol.PacketNumber only to be called once the handshake is complete // was a packet queued ReceivedAck processes an ACK frame.
It does not store a copy of the frame. ReceivedAckForPath processes a multipath ACK (PATH_ACK) for the
application-data packet number space identified by pid. An unknown pid
is a protocol violation; it never falls back to PathIDZero.( SentPacketHandler) ReceivedBytes(_ protocol.ByteCount, rcvTime monotime.Time)( SentPacketHandler) ReceivedPacket(protocol.EncryptionLevel, monotime.Time)( SentPacketHandler) ReceivedPacketForPath(pid protocol.PathID, size protocol.ByteCount, rcvTime monotime.Time) RemovePath removes a path provisioned by AddPath. It is used only to roll
back a path open that failed before becoming visible to the connection.( SentPacketHandler) ResetForRetry(rcvTime monotime.Time) The SendMode determines if and what kind of packets can be sent. SendModeForPath is SendMode for a send targeting application-data path
pid: the congestion/pacing checks use pid's own controller. For
PathIDZero it is identical to SendMode. SentPacket may modify the packet SentPacketForPath records a 1-RTT packet sent on the application-data
path pid (multipath). The bytes-in-flight, packet-number bookkeeping, and
congestion accounting land on pid's own appDataPath. For PathIDZero it is
identical to SentPacket with Encryption1RTT. SentPacketOneStream records the common 1-RTT packet containing one
STREAM frame without allocating a one-element slice.( SentPacketHandler) SetMaxDatagramSize(count protocol.ByteCount) TimeUntilSend is the time when the next packet should be sent.
It is used for pacing packets.
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) 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.
Package-Level Constants (total 7)
SendAck means an ACK-only packet should be sent
SendAny means that any packet should be sent
SendNone means that no packets should be sent
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.
SendPTOAppData means that an Application data probe packet should be sent
SendPTOHandshake means that a Handshake probe packet should be sent
SendPTOInitial means that an Initial probe packet should be sent
The pages are generated with Goldsv0.8.4. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.