Expand description
A library for simulating “traffic shaping” in Rust based on a generic futures::Stream
and futures::Sink
transformer that can be used to modify the delivery of items. The main purpose is to simulate various network
conditions such as:
- Delay (using a user provided function)
- Packet loss
- Packet reordering
- Packet corruption
- Packet duplication
- Bandwidth limiting
See [TrafficShaper
] for more information and an example.
§chokepoint command line tool
At ./cli you can find a simple cli tool for interactive exploration. Using a tool like graph-cli you can visualize the output. Here is an example to showcase delay, jitter and bandwidth:
$ chokepoint --help
Usage: chokepoint [OPTIONS] <MODE>
Arguments:
<MODE> Simulate a sink or a stream [possible values: stream, sink]
Options:
-v, --verbose
-n <N>
Number of packets to send [default: 250]
-o, --output <OUTPUT>
Output file (csv) with packet timing information
-r, --packet-rate <PACKET_RATE>
Send rate in packets per second
-s, --packet-size <PACKET_SIZE>
Packet size in bytes [default: 1B]
--ordering <ORDERING>
[default: ordered]
-l, --bandwidth-limit <BANDWIDTH_LIMIT>
Bandwidth limit
--mean <MEAN>
Mean latency in ms [default: 0.0]
--stddev <STDDEV>
Standard deviation of latency in ms (aka jitter) [default: 0.0]
-h, --help
Print help
Modules§
Structs§
- Choke
Settings - Settings for the
crate::ChokeStream
andcrate::ChokeSink
. - Choke
Sink - A
futures::Sink
that uses an underlayingChokeStream
to control how items are forwarded to the inner sink. - Choke
Stream - A traffic shaper that can simulate various network conditions.
Enums§
Traits§
- Choke
Item - A trait for payloads that can be used with the TrafficShaper.
Functions§
- normal_
distribution - Uses
rand_distr::Normal
to generate a normal distribution. - skewed_
distribution - Uses
rand_distr::SkewNormal
to generate a skewed distribution.