docs.rs failed to build msg-sim-0.1.5
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
msg-sim
Overview
This crate provides functionality to simulate real-world network conditions locally to and from a specific endpoint for testing and benchmarking purposes. It only works on MacOS and Linux.
Implementation
MacOS
On MacOS, we use a combination of the pfctl and dnctl tools.
pfctl is a tool to manage the packet filter device. dnctl can manage
the dummynet traffic shaper.
The general flow is as follows:
- Create a dummynet pipe with
dnctland configure it withbw,delay,plr
Example:
- Create a loopback alias with
ifconfigto simulate a different endpoint and set the MTU to the usual value (1500)
Example:
- Use
pfctlto create a rule to match traffic and send it through the pipe
Example:
# Create an anchor (a named container for rules, close to a namespace)
( && && \
) |
# Create a rule to match traffic from any to the alias and send it through the pipe
|
# Enable the packet filter
- Remove the rules and the pipe
# Apply the default configuration
# Disable the packet filter
# Remove the alias & reset the MTU
# Remove the dummynet pipes
Questions
- Do we need to create 2 pipes to simulate a bidirectional link? MAN page seems to say so.
Linux
On Linux, we use dummy interfaces and tc with netem to simulate and shape traffic.