Skip to content

Instantly share code, notes, and snippets.

@povilasb
Created May 16, 2019 15:01
Show Gist options
  • Save povilasb/2a7b95c3e5225fd47c5cbd58a2eb2f4a to your computer and use it in GitHub Desktop.
Save povilasb/2a7b95c3e5225fd47c5cbd58a2eb2f4a to your computer and use it in GitHub Desktop.
netsim 5 min presentation

netsim

https://github.com/canndrew/netsim

About

Rust library for network simulation

                   +--------+
                   | Server |
                   +--------+
                        ^
                        |
                        |
                        V
  +------+          +--------+                 +------+
  | NAT1 |<-------->| Router |<--------------> | NAT2 |
  +------+          +--------+                 +------+
     ^                                             ^
     |                                             |
     |                                             |
     V                                             V
+---------+                                   +---------+
| Client1 |                                   | Client2 |
+---------+                                   +---------+

Example


                           +--------+
        +----------------->| Router |<---------------------+
        |                  +--------+                      |
        |                                                  |
        V                                                  V
   +--------+                                          +--------+
   | Client |                                          | Server |
   +--------+                                          +--------+

Latency

  let node = node::ipv4::machine(move |ip| {
    // do smth
  }).latency(Duration::from_secs(2), Duration::from_millis(100));

Packet loss

  let node = node::ipv4::machine(move |ip| {
    // do smth
  }).latency(Duration::from_secs(2), Duration::from_millis(100))
    .packet_loss(0.25, Duration::from_millis(500));

Features

  • Latency
  • Packet loss
  • NAT
  • IPv6
  • pcap support
  • Packet filtering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment