Documentation ¶
Overview ¶
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. ` `from github.com/cevatbarisyilmaz/lossy
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConn ¶
NewConn wraps the given net.Conn with a latency connection.
bandwidth is in bytes/second. i.e. enter 1024 * 1024 for a 8 Mbit/s connection. Enter 0 or a negative value for an unlimited bandwidth.
minLatency and maxLatency is used to create a random latency for each packet. maxLatency should be equal or greater than minLatency. If bandwidth is not unlimited and there's no other packets waiting to be delivered, time to deliver a packet is (len(packet) + headerOverhead) / bandwidth + randomDuration(minLatency, maxLatency)
Types ¶
This section is empty.