-
Notifications
You must be signed in to change notification settings - Fork 9
/
lossy.go
29 lines (19 loc) · 1.1 KB
/
lossy.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
/*
Package lossy simulates bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces.
Its main usage is to test robustness of applications and network protocols run over unreliable transport protocols such as UDP or IP.
As a side benefit, it can also be used as outbound bandwidth limiter.
lossy only alters the writing side of the connection, reading side is kept as it is.
*/
package lossy
//IPv4MinHeaderOverhead is the minimum header overhead for IPv4 based connections.
const IPv4MinHeaderOverhead = 20
//IPv4MaxHeaderOverhead is the maximum header overhead for IPv4 based connections.
const IPv4MaxHeaderOverhead = 60
//IPv6HeaderOverhead is the header overhead for IPv6 based connections.
const IPv6HeaderOverhead = 40
//UDPv4MinHeaderOverhead is the minimum header overhead for UDP based connections over IPv4.
const UDPv4MinHeaderOverhead = 28
//UDPv4MaxHeaderOverhead is the maximum header overhead for UDP based connections over IPv4.
const UDPv4MaxHeaderOverhead = 68
//UDPv6HeaderOverhead is the header overhead for UDP based connections over IPv6.
const UDPv6HeaderOverhead = 48