#traffic #congestion #networking

chokepoint

Generic stream transformer to simulate traffic / network congestion

8 releases (4 breaking)

0.5.0 Feb 2, 2025
0.4.2 Dec 3, 2024
0.4.1 Nov 28, 2024
0.3.0 Nov 24, 2024
0.1.1 Nov 19, 2024

#371 in Simulation

Download history 114/week @ 2024-11-18 1345/week @ 2024-11-25 1292/week @ 2024-12-02 200/week @ 2024-12-09 118/week @ 2024-12-16 43/week @ 2024-12-23 139/week @ 2024-12-30 80/week @ 2025-01-06 75/week @ 2025-01-13 22/week @ 2025-01-20 134/week @ 2025-01-27 113/week @ 2025-02-03 71/week @ 2025-02-10 74/week @ 2025-02-17 235/week @ 2025-02-24 1244/week @ 2025-03-03

1,625 downloads per month

MPL-2.0 license

180KB
828 lines

chokepoint

Crates.io License

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:

Example

$ 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

Dependencies

~5–12MB
~125K SLoC