Documentation ¶
Index ¶
- Constants
- Variables
- func BytesPerSecondToPacketsPer64Sec(bps uint32, ss uint32) int64
- func LossSample(series string, lossRateInv uint32) dccp.Sample
- func RoundtripSample(series string, rtt int64) dccp.Sample
- type CCID3
- type LossDigestOption
- type LossEventRateOption
- type LossFeedback
- type LossInterval
- type LossIntervalDetail
- type LossIntervalsOption
- type ReceiveRateOption
- type RoundtripReportOption
- type UnencodedOption
- type XFeedback
Constants ¶
const ( NoFeedbackWeightNew = 1 NoFeedbackWeightOld = 2 NoFeedbackTimeoutWithoutRoundtrip = 2e9 // nofeedback timer expiration before RTT estimate, 2 sec )
const ( OptionLossEventRate = 192 OptionLossIntervals = 193 OptionReceiveRate = 194 // OptionLossDigest and OptionRoundtripReport ARE NOT part of CCID3. They are our own extension. OptionLossDigest = 210 OptionRoundtripReport = 150 )
CCID3-specific options
const ( MaxLossIntervals = 28 NDUPACK = 3 )
const ( RoundtripElapsedSample = "RTT-Elapsed" RoundtripReportSample = "RTT-Report" )
const ( SenderRoundtripHistoryLen = 20 // How many timestamps of sent packets to remember SenderRoundtripWeightNew = 1 SenderRoundtripWeightOld = 9 )
const ( // Maximum value of window counter, RFC 4342 Section 10.2 and RFC 3448 WindowCounterMod = 16 // The maximum increase in window counter from one window to the next WindowCounterMaxInc = 5 // Counter increase since last ack'd window WindowCounterAckInc = 4 // A nil value for window counter variables WindowCounterNil = WindowCounterMod )
const ( X_MAX_INIT_WIN = 4380 // Maximum size of initial window in bytes X_MAX_BACKOFF_INTERVAL = 64e9 // Maximum backoff interval in ns (See RFC 5348, Section 4.3) X_RECV_MAX = math.MaxInt32 // Maximum receive rate, in bytes per second X_RECV_SET_SIZE = 3 // Size of x_recv_set )
const FixedSegmentSize = 2 * 1500
const (
LossReceiverEstimateSample = "Loss-Receiver"
)
const NINTERVAL = 8
const ( // UnknownLossEventRateInv is the maximum representable loss event rate inverse, // and therefore corresponds to the minimum representable loss event rate. // In the CCID protocol, this constant is interpreted as 'no loss events detected'. // Its numerical value allows it be used safely in comparison operations. UnknownLossEventRateInv = math.MaxUint32 )
const WindowHistoryLen = 4 * 4 * 2
Variables ¶
var ( ErrMissingOption = errors.New("missing option") ErrNoAck = errors.New("packet is not an ack") )
TODO: Annotate each error with the circumstances that can cause it
var ( RoundtripElapsedCheckpoint roundtripElapsedCheckpoint RoundtripReportCheckpoint roundtripReportCheckpoint )
Functions ¶
func BytesPerSecondToPacketsPer64Sec ¶
BytesPerSecondToPacketsPer64Sec converts a rate in byter per second to packets of size ss per 64 seconds
func LossSample ¶
LossSample generates a log sample with loss information
Types ¶
type LossDigestOption ¶
type LossDigestOption struct { // RateInv is the inverse of the loss event rate, rounded UP, as calculated by the receiver. // A value of UnknownLossEventRateInv indicates that no loss events have been observed. RateInv uint32 // NewLoss indicates how many new loss events are reported by the feedback packet carrying this option NewLossCount byte }
The LossDigest option directly carries, from the receiver to the sender, the types of loss information that a CCID3 sender would have to reconstruct from the LossIntervals option. This is an extension to the RFC specification.
func DecodeLossDigestOption ¶
func DecodeLossDigestOption(opt *dccp.Option) *LossDigestOption
type LossEventRateOption ¶
type LossEventRateOption struct { // RateInv is the inverse of the loss event rate, rounded UP, as calculated by the receiver. // It is actually calculated as data packets per loss interval. RateInv uint32 }
func DecodeLossEventRateOption ¶
func DecodeLossEventRateOption(opt *dccp.Option) *LossEventRateOption
type LossFeedback ¶
type LossFeedback struct { RateInv uint32 // Loss event rate inverse NewLossCount byte // Number of loss events reported in this feedback packet RateInc bool // Has the loss rate increased since the last feedback packet }
LossFeedback contains summary of loss information updates returned by OnRead
type LossInterval ¶
type LossInterval struct { LosslessLength uint32 // Lossless Length, a 24-bit number, RFC 4342, Section 8.6.1 LossLength uint32 // Loss Length, a 23-bit number, RFC 4342, Section 8.6.1 DataLength uint32 // Data Length, a 24-bit number, RFC 4342, Section 8.6.1. // Specifies loss interval's data length, as defined in Section 6.1.1. ECNNonceEcho bool // ECN Nonce Echo, RFC 4342, Section 8.6.1 }
LossInterval describes an individual loss interval, RFC 4342, Section 8.6.2
func (*LossInterval) SeqLen ¶
func (li *LossInterval) SeqLen() uint32
SeqLen returns the sequence length of the loss interval
type LossIntervalDetail ¶
type LossIntervalDetail struct { LossInterval StartSeqNo int64 // The sequence number of the first packet in the loss interval StartTime int64 // The reception time of the first packet in the loss interval StartRTT int64 // The RTT estimate when the interval began Unfinished bool // True if the loss interval is still evolving }
LossIntervalDetail is an internal structure that contains more detailed information about a loss interval than the LossInterval structure that is transported inside a DCCP option.
type LossIntervalsOption ¶
type LossIntervalsOption struct { // SkipLength indicates the number of packets up to and including the Acknowledgement Number // that are not part of any Loss Interval. It must be less than or equal to NDUPACK = 3 SkipLength byte LossIntervals []*LossInterval }
LossIntervalsOption is described in RFC 4342, Section 8.6. Intervals are listed in reverse chronological order. Loss interval sequence numbers are delta encoded starting from the Acknowledgement Number. Therefore, Loss Intervals options MUST NOT be sent on packets without an Acknowledgement Number, and any Loss Intervals options received on such packets MUST be ignored.
func DecodeLossIntervalsOption ¶
func DecodeLossIntervalsOption(opt *dccp.Option) *LossIntervalsOption
type ReceiveRateOption ¶
type ReceiveRateOption struct { // The rate at which receiver has received data since it last send an Ack; in bytes per second Rate uint32 }
ReceiveRateOption is described in RFC 4342, Section 8.3.
func DecodeReceiveRateOption ¶
func DecodeReceiveRateOption(opt *dccp.Option) *ReceiveRateOption
type RoundtripReportOption ¶
type RoundtripReportOption struct { // The Roundtrip estimate is given in ten microsecond units, similarly to the // ElapsedTimeOption Roundtrip uint32 }
RoundtripReportOption is used by the sender to communicate its RTT estimate to the receiver.
func DecodeRoundtripReportOption ¶
func DecodeRoundtripReportOption(opt *dccp.Option) *RoundtripReportOption
type UnencodedOption ¶
Unencoded option is a type that knows how to encode itself into a dccp.Option
type XFeedback ¶
type XFeedback struct { Now int64 // Time now SS uint32 // Segment size XRecv uint32 // Receive rate RTT int64 // Round-trip time LossFeedback // Loss-related feedback }
XFeedback contains computed feedback variables that are used by the rate calculator to update the allowed sending rate