idofront / TrafficPlayer

TrafficPlayer is a Linux application to recreate network traffic. It replays pcap files to simulate conditions. Users can specify a NIC for better control. TrafficPlayer allows speed adjustment, offering flexibility in testing behaviors. It is ideal for evaluating network performance and reliability.

Repository from Github https://github.comidofront/TrafficPlayerRepository from Github https://github.comidofront/TrafficPlayer

TrafficPlayer

TrafficPlayer is an application designed to replay network traffic based on different strategies, providing flexibility in testing and analyzing network behaviors. This project supports various replay modes, including custom duration, speed scaling, and average throughput.

Features

  • CustomDuration Replay: Replay traffic for a specified duration, giving users control over timing.
  • SpeedScaled Replay: Adjust the replay speed of captured traffic, scaling it up or down as needed.
  • AverageThroughput Replay: Replay traffic with an average throughput, maintaining consistent data rates over time.

Requirements

  • C++ Compiler: Requires a C++17 or newer compatible compiler.
  • CPU: It is recommended to use a CPU with at least 3 threads for optimal performance.
  • CMake: Used for managing the build process.

Installation

  1. Clone the repository:
    git clone https://github.com/idofront/TrafficPlayer
    cd TrafficPlayer
  2. Create a build directory and configure the project:
    mkdir build && cd build
    cmake ..
  3. Build the project:
    make

Usage

After building the project, you can execute TrafficPlayer with different options:

./build/TrafficPlayer [OPTIONS] [SUBCOMMAND]

Options:

  • -h, --help: Print this help message and exit.
  • -p, --pcap <path>: Path to the pcap file (required).
  • -i, --interface <name>: Network interface to send packets (required).
  • --log-level <level>: Log level (trace, debug, info, warn, error, critical, off).
  • --report-interval <seconds>: Interval to show reports in seconds (default: 1).
  • --repeat <times>: Number of times to repeat the traffic. 0 means infinite repeat (default: 1).
  • --dry-run: Do not send packets, just show reports. No network interface is required. No root permission is required.
  • --hex: Show packets in hex format.
  • --ascii: Show packets in ascii characters.

Subcommands:

  • throughput: Throughput mode - replay at a specified throughput.
  • scale: Speed scale mode - adjust replay speed by a factor.
  • duration: Custom duration mode - replay all packets within a specified duration.
  • pps: Packets per second mode: Replay at a specified rate

License

This project is licensed under the MIT License.

About

TrafficPlayer is a Linux application to recreate network traffic. It replays pcap files to simulate conditions. Users can specify a NIC for better control. TrafficPlayer allows speed adjustment, offering flexibility in testing behaviors. It is ideal for evaluating network performance and reliability.

License:MIT License


Languages

Language:C++ 95.1%Language:CMake 4.9%