Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI reference

The wpg binary runs both the server (wpg serve) and the headless tools, so it suits CI and ssh sessions too. For example, wpg send tpl.wpg.yaml -i eth0 --rate 1Mpps transmits a template. This page is generated from the command definitions: each block is the verbatim --help output of the current build. Run-time messages follow LANG / LC_ALL; the --help text itself is English.

Commands

wpg

Web Packet Generator

Usage: wpg [OPTIONS] <COMMAND>

Commands:
  serve      Start the web UI / API server
  send       Send a template headlessly
  render     Render a template to a pcapng file without transmitting
  import     Convert a pcap/pcapng capture into a template
  template   Template tools (lint, list, migrate, export, import)
  ifaces     List network interfaces usable for transmission
  doctor     Diagnose privileges, drivers, hugepages and Npcap
  bench      Measure transmit performance
  capture    Receive: counters, the first frames, pcapng output, signature verification
  config     Configuration file tools (init, show, validate) and API tokens
  remote     Drive a running server with an API token (jobs, templates)
  protocols  Protocol tools (list, show, check user-defined protocol files)
  help       Print this message or the help of the given subcommand(s)

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg serve

Start the web UI / API server

Usage: wpg serve [OPTIONS]

Options:
      --bind <BIND>
          Address to listen on (default from the config: 127.0.0.1:8080). Without a password only loopback addresses are accepted (see --allow-insecure)

          [env: WPG_BIND]

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --password <PASSWORD>
          Admin password (plain text or argon2 hash). Visible in the process list: prefer --password-file, `WPG_PASSWORD` or `wpg config set-password`

      --password-file <FILE>
          File holding the admin password (plain text or argon2 hash)

      --tls
          Serve HTTPS; without `[server.tls]` a self-signed certificate is generated into `<data_dir>/tls/`

      --allow-insecure
          Listen on a non-loopback address even though no password is configured (anyone reaching the server can then set it on the setup screen)

      --dev
          Development mode: allow CORS from the Trunk dev server (:8081)

      --library-path <DIR>
          Template library directory (repeatable; replaces `templates.library_paths`)

      --data-dir <DIR>
          Data directory (user templates, history)

  -h, --help
          Print help

  -V, --version
          Print version

wpg send

Sends a template. --plan chooses between expanding all frames up front (prerender) and building them while sending (onthefly). --json prints the final report on stdout.

Send a template headlessly

Usage: wpg send [OPTIONS] <TEMPLATE>

Arguments:
  <TEMPLATE>
          Template file (`.wpg.yaml`)

Options:
  -i, --iface <IFACE>
          Interface to transmit on

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --backend <BACKEND>
          Transmit backend (null, pcapfile, pcap, afpacket, afxdp, dpdk)

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --count <COUNT>
          Number of packets

      --duration <DURATION>
          Duration limit, e.g. `10s`, `2m`

      --rate <RATE>
          Rate, e.g. `1Mpps`, `10Gbps`, `50%`, `ifg=10us`, `unlimited`

      --burst <BURST>
          Frames sent back to back per rate-control grant

      --wait <MODE>
          How the rate control waits: hybrid (sleep, then spin), sleep, spin or busy-poll (spin and service the backend)

      --clock <CLOCK>
          Rate-control clock: auto (TSC when invariant), tsc or monotonic

          [default: auto]

      --ramp-up <DURATION>
          Ramp the rate up linearly from 0 over this time, e.g. `5s`

      --start-at <TIME>
          Start at this time: RFC 3339 (`2026-09-29T12:00:00Z`) or a delay (`+10s`)

      --plan <PLAN>
          Expansion strategy: auto, prerender or onthefly

          [default: auto]

      --prerender-max-bytes <BYTES>
          `auto` pre-renders only streams up to this many bytes (default: `tx.prerender_max_bytes`, 256 MiB)

      --prerender-max-packets <N>
          `auto` pre-renders only streams up to this many packets (default: `tx.prerender_max_packets`, 100M)

      --json
          Print the final report as JSON on stdout

      --var <NAME=VALUE>
          Template variable override (`name=value`), repeatable; wins over --vars-file

      --vars-file <FILE>
          YAML or JSON map of template variable values

      --set <LAYER.FIELD=VALUE>
          Set a field to a fixed value, repeatable. LAYER is a protocol id, `proto[n]` or a layer index, e.g. `ipv4.ttl=1`

      --gen <LAYER.FIELD=GEN>
          Vary a field with a generator, repeatable, e.g. `udp.src_port=range:1000..1999`, `ipv4.dst=list:10.0.0.1,10.0.0.2`, `ipv4.id=random`

      --signature
          Stamp every frame with a receive-verification signature (magic, stream id, sequence number, TX time over the last 24 payload octets; see `wpg capture --verify`)

      --stream-id <ID>
          Signature stream id (with `--signature`)

          [default: 0]

      --batch <N>
          Frames per `send_batch` call

      --ring-depth <N>
          TX ring depth in frames (`afpacket`)

      --ring-bytes <BYTES>
          Memory of one TX ring / UMEM per worker in bytes (`afpacket`, `afxdp`; default: `tx.ring_bytes`, 16 MiB)

      --pin-core <CORE>
          Pin the TX thread to this CPU core (Linux; the first worker)

      --pin-cores <CORES>
          Pin worker i to the i-th core of this list, e.g. `1,2` (Linux)

      --workers <N>
          TX worker threads, each with its own backend instance (afpacket: socket and ring) and share of the stream and rate

          [default: 1]

      --qdisc-bypass
          Bypass the qdisc layer (`afpacket`, `PACKET_QDISC_BYPASS`)

      --no-tx-ring
          Use `sendmmsg` instead of the TPACKET_V3 TX ring (`afpacket`)

      --auto-pin
          Pin the workers to cores on the NIC's NUMA node, core 0 last (Linux; ignored when --pin-cores is given)

      --queue <N>
          First hardware queue (`afxdp`, `dpdk`; worker i uses queue N+i)

      --xdp-mode <MODE>
          AF_XDP bind mode: auto (zero-copy, else copy), copy or zerocopy

          [default: auto]

      --busy-poll
          Busy polling: `afxdp` sockets busy-poll the driver (kernel 5.11+) and `wpg send` paces with `--wait busy-poll` unless --wait says otherwise

      --eal-args <ARGS>
          DPDK EAL arguments (`dpdk`), e.g. "-a 0000:00:04.0 --file-prefix wpg" (split on whitespace; wpg adds `-l <first CPU>` and `--in-memory` unless given)

  -h, --help
          Print help

  -V, --version
          Print version

wpg render

Writes the frames of a template to a pcapng file without transmitting.

Render a template to a pcapng file without transmitting

Usage: wpg render [OPTIONS] --output <OUTPUT> <TEMPLATE>

Arguments:
  <TEMPLATE>
          Template file

Options:
  -o, --output <OUTPUT>
          Output pcapng file (`-` writes it to standard output)

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --count <COUNT>
          Number of packets

      --var <NAME=VALUE>
          Template variable override (`name=value`), repeatable; wins over --vars-file

      --vars-file <FILE>
          YAML or JSON map of template variable values

      --set <LAYER.FIELD=VALUE>
          Set a field to a fixed value, repeatable. LAYER is a protocol id, `proto[n]` or a layer index, e.g. `ipv4.ttl=1`

      --gen <LAYER.FIELD=GEN>
          Vary a field with a generator, repeatable, e.g. `udp.src_port=range:1000..1999`, `ipv4.dst=list:10.0.0.1,10.0.0.2`, `ipv4.id=random`

      --json
          Print the result (packets, bytes, path) as JSON on stdout

  -h, --help
          Print help

  -V, --version
          Print version

wpg import

Turns a capture (or pasted hex) into a template; see the pcap replay tutorial.

Convert a pcap/pcapng capture into a template

Usage: wpg import [OPTIONS] <INPUT>

Arguments:
  <INPUT>
          Input: a `.pcap` / `.pcapng` capture, a hex dump (`.hex`, see `--hex`) or `-` for standard input

Options:
  -o, --output <OUTPUT>
          Output template (`-` prints YAML on standard output)

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --per-packet <DIR>
          Write one template per packet into this directory instead of one merged template

      --first-protocol <PROTOCOL>
          Protocol the frames start with

          [default: ethernet2]

      --max-packets <N>
          Read at most this many packets

      --no-detect-generators
          Do not infer generators (range / list / random) from the packets

      --hex
          Treat the input as pasted hex (Wireshark hex stream, spaced bytes, hexdump)

  -h, --help
          Print help

  -V, --version
          Print version

wpg template

Template tools. lint exits with status 1 on errors; export and import pack templates into, and unpack them from, .wpgbundle archives.

Template tools (lint, list, migrate, export, import)

Usage: wpg template [OPTIONS] <COMMAND>

Commands:
  lint     Check templates for errors and warnings (exit status 3 on errors)
  list     List the templates of a directory (default: `templates/`)
  show     Print the built packet (hex dump and layout tree) of a template
  schema   Print the JSON Schema of the template format
  export   Pack templates (files or ids) into a `.wpgbundle` archive
  migrate  Upgrade templates to the current schema version
  import   Extract the templates of a `.wpgbundle` archive into a directory
  help     Print this message or the help of the given subcommand(s)

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg template lint

Check templates for errors and warnings (exit status 3 on errors)

Usage: wpg template lint [OPTIONS] <FILES>...

Arguments:
  <FILES>...
          Template files

Options:
      --json
          Print the issues as JSON on stdout

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg template list

List the templates of a directory (default: `templates/`)

Usage: wpg template list [OPTIONS] [DIR]

Arguments:
  [DIR]
          Directory to scan recursively

Options:
      --json
          Print the list as JSON on stdout

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg template show

Print the built packet (hex dump and layout tree) of a template

Usage: wpg template show [OPTIONS] <FILE>

Arguments:
  <FILE>
          Template file

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --var <NAME=VALUE>
          Template variable override (`name=value`), repeatable; wins over --vars-file

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --vars-file <FILE>
          YAML or JSON map of template variable values

      --set <LAYER.FIELD=VALUE>
          Set a field to a fixed value, repeatable. LAYER is a protocol id, `proto[n]` or a layer index, e.g. `ipv4.ttl=1`

      --gen <LAYER.FIELD=GEN>
          Vary a field with a generator, repeatable, e.g. `udp.src_port=range:1000..1999`, `ipv4.dst=list:10.0.0.1,10.0.0.2`, `ipv4.id=random`

      --json
          Print the packet (hex, layers, fields) as JSON on stdout

  -h, --help
          Print help

  -V, --version
          Print version

wpg template schema

Print the JSON Schema of the template format

Usage: wpg template schema [OPTIONS]

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg template export

Pack templates (files or ids) into a `.wpgbundle` archive

Usage: wpg template export [OPTIONS] --output <OUTPUT> <TEMPLATES>...

Arguments:
  <TEMPLATES>...
          Template files, or ids (file stem / name slug) looked up in `--dir`

Options:
  -o, --output <OUTPUT>
          Output bundle

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --attach <FILE>
          Attach a capture (pcap / pcapng) or other file, repeatable

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --dir <DIR>
          Template library used to resolve ids (default: `templates/`)

  -h, --help
          Print help

  -V, --version
          Print version

wpg template migrate

Upgrade templates to the current schema version.

Directories are scanned recursively. The original of a rewritten file is kept as `<file>.bak`; the new file loses its comments. Files already at the current version are not touched.

Usage: wpg template migrate [OPTIONS] <PATHS>...

Arguments:
  <PATHS>...
          Template files or directories

Options:
      --check
          Only report outdated templates (exit status 1 if any needs migrating)

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --no-backup
          Do not keep a `.bak` copy of migrated files

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

wpg template import

Extract the templates of a `.wpgbundle` archive into a directory

Usage: wpg template import [OPTIONS] --output <OUTPUT> <BUNDLE>

Arguments:
  <BUNDLE>
          The bundle

Options:
  -o, --output <OUTPUT>
          Output directory

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --force
          Overwrite existing files

  -h, --help
          Print help

  -V, --version
          Print version

wpg ifaces

Lists interfaces with MAC, addresses, MTU, link state and driver.

List network interfaces usable for transmission

Usage: wpg ifaces [OPTIONS]

Options:
      --json
          Output JSON

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg doctor

Runs the environment checks described in Permissions; the exit status is non-zero when a check fails.

Diagnose privileges, drivers, hugepages and Npcap

Usage: wpg doctor [OPTIONS]

Options:
      --json
          Output JSON

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg bench

Unlimited-rate transmission of a synthetic frame (EtherType 0x88b5), or of a template with --template. See docs/perf.md for baselines. --json output fields: backend, detail, iface, frame_size, batch_size, packets, dropped, pps, bps (L2), l1_bps, elapsed.

Measure transmit performance

Usage: wpg bench [OPTIONS]

Options:
      --backend <BACKEND>
          Backend to benchmark

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -i, --iface <IFACE>
          Interface (for real backends)

      --duration <DURATION>
          Duration in seconds

          [default: 5]

      --frame-size <FRAME_SIZE>
          Frame size in bytes (without FCS)

          [default: 64]

      --template <FILE>
          Benchmark on-the-fly generation of this template instead of a fixed frame

      --var <NAME=VALUE>
          Template variable override (`name=value`), repeatable; wins over --vars-file

      --vars-file <FILE>
          YAML or JSON map of template variable values

      --set <LAYER.FIELD=VALUE>
          Set a field to a fixed value, repeatable. LAYER is a protocol id, `proto[n]` or a layer index, e.g. `ipv4.ttl=1`

      --gen <LAYER.FIELD=GEN>
          Vary a field with a generator, repeatable, e.g. `udp.src_port=range:1000..1999`, `ipv4.dst=list:10.0.0.1,10.0.0.2`, `ipv4.id=random`

      --json
          Output JSON

      --batch <N>
          Frames per `send_batch` call

      --ring-depth <N>
          TX ring depth in frames (`afpacket`)

      --ring-bytes <BYTES>
          Memory of one TX ring / UMEM per worker in bytes (`afpacket`, `afxdp`; default: `tx.ring_bytes`, 16 MiB)

      --pin-core <CORE>
          Pin the TX thread to this CPU core (Linux; the first worker)

      --pin-cores <CORES>
          Pin worker i to the i-th core of this list, e.g. `1,2` (Linux)

      --workers <N>
          TX worker threads, each with its own backend instance (afpacket: socket and ring) and share of the stream and rate

          [default: 1]

      --qdisc-bypass
          Bypass the qdisc layer (`afpacket`, `PACKET_QDISC_BYPASS`)

      --no-tx-ring
          Use `sendmmsg` instead of the TPACKET_V3 TX ring (`afpacket`)

      --auto-pin
          Pin the workers to cores on the NIC's NUMA node, core 0 last (Linux; ignored when --pin-cores is given)

      --queue <N>
          First hardware queue (`afxdp`, `dpdk`; worker i uses queue N+i)

      --xdp-mode <MODE>
          AF_XDP bind mode: auto (zero-copy, else copy), copy or zerocopy

          [default: auto]

      --busy-poll
          Busy polling: `afxdp` sockets busy-poll the driver (kernel 5.11+) and `wpg send` paces with `--wait busy-poll` unless --wait says otherwise

      --eal-args <ARGS>
          DPDK EAL arguments (`dpdk`), e.g. "-a 0000:00:04.0 --file-prefix wpg" (split on whitespace; wpg adds `-l <first CPU>` and `--in-memory` unless given)

  -h, --help
          Print help

  -V, --version
          Print version

wpg capture

Receive: counters, the first frames, pcapng output, signature verification

Usage: wpg capture [OPTIONS]

Options:
  -i, --iface <IFACE>
          Interface to receive on (`any` = every interface with `afpacket`); for the `pcapfile` backend the capture file to replay

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --backend <BACKEND>
          Receive backend: afpacket (Linux), pcap (feature `pcap`), pcapfile, null

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -f, --filter <EXPR>
          tcpdump-style filter, e.g. `udp port 5001 and wpg` (default: every frame)

  -c, --count <COUNT>
          Stop after this many matching frames

      --duration <DURATION>
          Stop after this long, e.g. `10s`

      --show <N>
          Print the first N matching frames

          [default: 5]

      --hex
          Also print a hex dump of the shown frames

  -w, --write <FILE>
          Write the matching frames to this pcapng file

      --verify
          Check the signatures stamped by `wpg send --signature` (loss / order / latency)

      --promisc
          Promiscuous mode

      --include-outgoing
          Also count frames this host transmits

      --json
          Machine-readable output

  -h, --help
          Print help

  -V, --version
          Print version

wpg config

wpg.toml tools; see the configuration reference.

Configuration file tools (init, show, validate) and API tokens

Usage: wpg config [OPTIONS] <COMMAND>

Commands:
  init          Write a fully commented example `wpg.toml`
  show          Print the effective configuration (file + environment) as TOML, secrets redacted
  validate      Check the configuration; exit status 1 on errors
  set-password  Prompt for the admin password and store its argon2id hash as `auth.password_hash` (the file is created from the example if missing)
  token         API tokens for scripts and `wpg remote` (create, list, revoke), stored in the server's database
  help          Print this message or the help of the given subcommand(s)

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg config init

Write a fully commented example `wpg.toml`

Usage: wpg config init [OPTIONS]

Options:
      --path <FILE>
          Output file

          [default: wpg.toml]

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --force
          Overwrite an existing file

  -h, --help
          Print help

  -V, --version
          Print version

wpg config show

Print the effective configuration (file + environment) as TOML, secrets redacted

Usage: wpg config show [OPTIONS]

Options:
      --config <FILE>
          Configuration file (default: `wpg.toml` if present)

          [env: WPG_CONFIG]

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

  -h, --help
          Print help

  -V, --version
          Print version

wpg config validate

Check the configuration; exit status 1 on errors

Usage: wpg config validate [OPTIONS]

Options:
      --config <FILE>
          Configuration file (default: `wpg.toml` if present)

          [env: WPG_CONFIG]

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

  -h, --help
          Print help

  -V, --version
          Print version

wpg config set-password

Prompt for the admin password and store its argon2id hash as `auth.password_hash` (the file is created from the example if missing)

Usage: wpg config set-password [OPTIONS]

Options:
      --config <FILE>
          Configuration file to update

          [env: WPG_CONFIG]
          [default: wpg.toml]

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --stdin
          Read the password from the first line of standard input (no prompt)

  -h, --help
          Print help

  -V, --version
          Print version

wpg config token

Manages API tokens directly in the server’s database (<data_dir>/wpg.sqlite), also while the server runs. create prints only the secret on standard output.

API tokens for scripts and `wpg remote` (create, list, revoke), stored in the server's database

Usage: wpg config token [OPTIONS] <COMMAND>

Commands:
  create  Create a token and print its secret (shown only once)
  list    List the tokens (never their secrets)
  revoke  Revoke (delete) a token by id
  help    Print this message or the help of the given subcommand(s)

Options:
      --data-dir <DIR>
          Data directory holding `wpg.sqlite` (default: `data_dir` of the configuration)

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg config token create

Create a token and print its secret (shown only once)

Usage: wpg config token create [OPTIONS] <NAME>

Arguments:
  <NAME>
          Name, to recognise the token later

Options:
      --data-dir <DIR>
          Data directory holding `wpg.sqlite` (default: `data_dir` of the configuration)

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --user <USER>
          User the token acts as (with that user's role)

          [default: admin]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --expires-days <DAYS>
          Expire after this many days (default: never)

      --json
          Print the token and its secret as JSON

  -h, --help
          Print help

  -V, --version
          Print version

wpg config token list

List the tokens (never their secrets)

Usage: wpg config token list [OPTIONS]

Options:
      --data-dir <DIR>
          Data directory holding `wpg.sqlite` (default: `data_dir` of the configuration)

      --json
          Print JSON

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg config token revoke

Revoke (delete) a token by id

Usage: wpg config token revoke [OPTIONS] <ID>

Arguments:
  <ID>
          Token id (see `wpg config token list`)

Options:
      --data-dir <DIR>
          Data directory holding `wpg.sqlite` (default: `data_dir` of the configuration)

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg remote

Drives a running server through its API with an API token; see Authentication and TLS. Exit status: 0 success, 1 the job failed (jobs wait, jobs start --wait), 2 any other error.

Drive a running server with an API token (jobs, templates)

Usage: wpg remote [OPTIONS] <COMMAND>

Commands:
  jobs       Transmit jobs: list, start, stop, wait
  templates  The server's template library: list, push
  help       Print this message or the help of the given subcommand(s)

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --server <URL>
          Server URL

          [env: WPG_SERVER]
          [default: http://127.0.0.1:8080]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --token <TOKEN>
          API token (`wpg_...`). Visible in the process list: prefer `WPG_TOKEN`

          [env: WPG_TOKEN]

      --insecure
          Accept any TLS certificate (for servers with a self-signed certificate)

      --json
          Print the server's JSON responses

  -h, --help
          Print help

  -V, --version
          Print version

wpg remote jobs

Transmit jobs: list, start, stop, wait

Usage: wpg remote jobs [OPTIONS] <COMMAND>

Commands:
  list   List the server's jobs (running and recently finished)
  start  Start a job from a library template id or a local template file; prints the job id
  stop   Stop a job
  wait   Wait until a job ends; exit status 1 if it failed
  help   Print this message or the help of the given subcommand(s)

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --server <URL>
          Server URL

          [env: WPG_SERVER]
          [default: http://127.0.0.1:8080]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --token <TOKEN>
          API token (`wpg_...`). Visible in the process list: prefer `WPG_TOKEN`

          [env: WPG_TOKEN]

      --insecure
          Accept any TLS certificate (for servers with a self-signed certificate)

      --json
          Print the server's JSON responses

  -h, --help
          Print help

  -V, --version
          Print version

wpg remote jobs list

List the server's jobs (running and recently finished)

Usage: wpg remote jobs list [OPTIONS]

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --server <URL>
          Server URL

          [env: WPG_SERVER]
          [default: http://127.0.0.1:8080]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --token <TOKEN>
          API token (`wpg_...`). Visible in the process list: prefer `WPG_TOKEN`

          [env: WPG_TOKEN]

      --insecure
          Accept any TLS certificate (for servers with a self-signed certificate)

      --json
          Print the server's JSON responses

  -h, --help
          Print help

  -V, --version
          Print version

wpg remote jobs start

Start a job from a library template id or a local template file; prints the job id

Usage: wpg remote jobs start [OPTIONS] <TEMPLATE>

Arguments:
  <TEMPLATE>
          Template id on the server, or a local `.wpg.yaml` file sent with the job

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --server <URL>
          Server URL

          [env: WPG_SERVER]
          [default: http://127.0.0.1:8080]

      --var <NAME=VALUE>
          Template variable value (repeatable)

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --rate <RATE>
          Rate, e.g. `1000pps`, `1Mpps`, `10Gbps`, `unlimited`

      --token <TOKEN>
          API token (`wpg_...`). Visible in the process list: prefer `WPG_TOKEN`

          [env: WPG_TOKEN]

      --count <COUNT>
          Number of packets

      --insecure
          Accept any TLS certificate (for servers with a self-signed certificate)

      --duration <DURATION>
          Duration limit, e.g. `10s`, `2m`

      --json
          Print the server's JSON responses

  -i, --iface <IFACE>
          Interface on the server

      --backend <BACKEND>
          Transmit backend (default: the server's)

      --name <NAME>
          Job name

      --wait
          Wait until the job ends (like `wpg remote jobs wait`)

  -h, --help
          Print help

  -V, --version
          Print version

wpg remote jobs stop

Stop a job

Usage: wpg remote jobs stop [OPTIONS] <ID>

Arguments:
  <ID>
          Job id

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --server <URL>
          Server URL

          [env: WPG_SERVER]
          [default: http://127.0.0.1:8080]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --token <TOKEN>
          API token (`wpg_...`). Visible in the process list: prefer `WPG_TOKEN`

          [env: WPG_TOKEN]

      --insecure
          Accept any TLS certificate (for servers with a self-signed certificate)

      --json
          Print the server's JSON responses

  -h, --help
          Print help

  -V, --version
          Print version

wpg remote jobs wait

Wait until a job ends; exit status 1 if it failed

Usage: wpg remote jobs wait [OPTIONS] <ID>

Arguments:
  <ID>
          Job id

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --server <URL>
          Server URL

          [env: WPG_SERVER]
          [default: http://127.0.0.1:8080]

      --timeout <SECS>
          Give up after this many seconds (exit status 2)

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --token <TOKEN>
          API token (`wpg_...`). Visible in the process list: prefer `WPG_TOKEN`

          [env: WPG_TOKEN]

      --insecure
          Accept any TLS certificate (for servers with a self-signed certificate)

      --json
          Print the server's JSON responses

  -h, --help
          Print help

  -V, --version
          Print version

wpg remote templates

The server's template library: list, push

Usage: wpg remote templates [OPTIONS] <COMMAND>

Commands:
  list  List the templates on the server
  push  Upload a template file to the server's user templates; prints its id
  help  Print this message or the help of the given subcommand(s)

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --server <URL>
          Server URL

          [env: WPG_SERVER]
          [default: http://127.0.0.1:8080]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --token <TOKEN>
          API token (`wpg_...`). Visible in the process list: prefer `WPG_TOKEN`

          [env: WPG_TOKEN]

      --insecure
          Accept any TLS certificate (for servers with a self-signed certificate)

      --json
          Print the server's JSON responses

  -h, --help
          Print help

  -V, --version
          Print version

wpg remote templates list

List the templates on the server

Usage: wpg remote templates list [OPTIONS]

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --server <URL>
          Server URL

          [env: WPG_SERVER]
          [default: http://127.0.0.1:8080]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --token <TOKEN>
          API token (`wpg_...`). Visible in the process list: prefer `WPG_TOKEN`

          [env: WPG_TOKEN]

      --insecure
          Accept any TLS certificate (for servers with a self-signed certificate)

      --json
          Print the server's JSON responses

  -h, --help
          Print help

  -V, --version
          Print version

wpg remote templates push

Upload a template file to the server's user templates; prints its id

Usage: wpg remote templates push [OPTIONS] <FILE>

Arguments:
  <FILE>
          Template file (`.wpg.yaml`)

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --server <URL>
          Server URL

          [env: WPG_SERVER]
          [default: http://127.0.0.1:8080]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

      --token <TOKEN>
          API token (`wpg_...`). Visible in the process list: prefer `WPG_TOKEN`

          [env: WPG_TOKEN]

      --insecure
          Accept any TLS certificate (for servers with a self-signed certificate)

      --json
          Print the server's JSON responses

  -h, --help
          Print help

  -V, --version
          Print version

wpg protocols

Protocol tools (list, show, check user-defined protocol files)

Usage: wpg protocols [OPTIONS] <COMMAND>

Commands:
  list   List the protocols: built-in ones and those of `--protocols-dir`
  show   Print a protocol definition, as an extension file to start a new protocol from (change its `id` first)
  check  Check user-defined protocol files (exit status 1 on errors)
  help   Print this message or the help of the given subcommand(s)

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg protocols list

List the protocols: built-in ones and those of `--protocols-dir`

Usage: wpg protocols list [OPTIONS]

Options:
      --json
          Output JSON

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg protocols show

Print a protocol definition, as an extension file to start a new protocol from (change its `id` first)

Usage: wpg protocols show [OPTIONS] <ID>

Arguments:
  <ID>
          Protocol id (`udp`, `ipv4`, ...)

Options:
      --json
          Output the definition as JSON instead of YAML

      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help

  -V, --version
          Print version

wpg protocols check

Check user-defined protocol files (exit status 1 on errors).

The files are checked together, with the built-in protocols and the other files of `--protocols-dir`.

Usage: wpg protocols check [OPTIONS] <PATHS>...

Arguments:
  <PATHS>...
          Extension files (`*.yaml`) or directories holding them

Options:
      --protocols-dir <DIR>
          Directory of user-defined protocol files (`*.yaml`, repeatable; added to `[protocols] dirs` of the configuration)

          [env: WPG_PROTOCOLS_DIR]

      --config <FILE>
          Configuration file (default: `wpg.toml` in the working directory, if any). `wpg send` also takes its default backend and rate limit from `[tx]`

          [env: WPG_CONFIG]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version