-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathdefaults.go
131 lines (104 loc) · 3.92 KB
/
defaults.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package irtt
import (
"time"
)
// Common defaults.
const (
DefaultIPVersion = DualStack
DefaultPort = "2112"
DefaultPortInt = 2112
DefaultTTL = 0
DefaultThreadLock = false
)
// Client defaults.
const (
DefaultDuration = 1 * time.Minute
DefaultInterval = 1 * time.Second
DefaultLength = 0
DefaultReceivedStats = ReceivedStatsBoth
DefaultStampAt = AtBoth
DefaultClock = BothClocks
DefaultDSCP = 0
DefaultLoose = false
DefaultLocalAddress = ":0"
DefaultLocalPort = "0"
DefaultDF = DFDefault
DefaultCompTimerMinErrorFactor = 0.0
DefaultCompTimerMaxErrorFactor = 2.0
DefaultHybridTimerSleepFactor = 0.95
DefaultAverageWindow = 5
DefaultExponentialAverageAlpha = 0.1
)
// DefaultOpenTimeouts are the default timeouts used when the client opens a
// connection to the server.
var DefaultOpenTimeouts = Durations([]time.Duration{
1 * time.Second,
2 * time.Second,
4 * time.Second,
8 * time.Second,
})
// DefaultCompTimerAverage is the default timer error averaging algorithm for
// the CompTimer.
var DefaultCompTimerAverage = NewDefaultExponentialAverager()
// DefaultWait is the default client wait time for the final responses after all
// packets have been sent.
var DefaultWait = &WaitMaxRTT{time.Duration(4) * time.Second, 3}
// DefaultTimer is the default timer implementation, CompTimer.
var DefaultTimer = NewCompTimer(DefaultCompTimerAverage)
// DefaultTimeSource is the default TimeSource implementation (WindowsTimeSource
// for Windows and GoTimeSource for everything else).
var DefaultTimeSource = NewDefaultTimeSource()
// DefaultFillPattern is the default fill pattern.
var DefaultFillPattern = []byte("irtt")
// DefaultServerFiller it the default filler for the server, PatternFiller.
var DefaultServerFiller = NewDefaultPatternFiller()
// Server defaults.
const (
DefaultMaxDuration = time.Duration(0)
DefaultMinInterval = 10 * time.Millisecond
DefaultMaxLength = 0
DefaultServerTimeout = 1 * time.Minute
DefaultPacketBurst = 5
DefaultAllowStamp = DualStamps
DefaultAllowDSCP = true
DefaultSetSrcIP = false
DefaultSetECN = false
)
// DefaultBindAddrs are the default bind addresses.
var DefaultBindAddrs = []string{":2112"}
// DefaultAllowFills are the default allowed fill prefixes.
var DefaultAllowFills = []string{"rand"}
// server duplicates and drops for testing (0.0-1.0)
const serverDupsPercent = 0
const serverDropsPercent = 0
// grace period for connection closure due to timeout
const timeoutGrace = 5 * time.Second
// factor of timeout used for maximum interval
const maxIntervalTimeoutFactor = 4
// max test duration grace period
const maxDurationGrace = 2 * time.Second
// ignore server restrictions (for testing hard limits)
const ignoreServerRestrictions = false
// settings for testing
const clientDropsPercent = 0
// minOpenTimeout sets the minimum time open() will wait before sending the
// next packet. This prevents clients from requesting a timeout that sends
// packets to the server too quickly.
const minOpenTimeout = 200 * time.Millisecond
// maximum initial length of pattern filler buffer
const patternMaxInitLen = 4 * 1024
// maxMTU is the MTU used if it could not be determined by autodetection.
const maxMTU = 64 * 1024
// minimum valid MTU per RFC 791
const minValidMTU = 68
// number of sconns to check to remove on each add (2 seems to be the least
// aggresive number where the map size still levels off over time, but I use 5
// to clean up unused sconns more quickly)
const checkExpiredCount = 5
// initial capacity for sconns map
const sconnsInitSize = 32
// maximum length of server fill string
const maxServerFillLen = 32
// minRestrictedInterval is the minimum restricted interval that the client will
// accept from the server.
const minRestrictedInterval = 1 * time.Second