lossy

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 4 Imported by: 0

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

func NewConn(c net.Conn, bandwidth uint64, minLatency, maxLatency time.Duration) net.Conn

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL