xfr
A modern iperf3 alternative with a live TUI, multi-client server, and QUIC support. Built in Rust.
Quick Start
# Server
# Client (in another terminal or machine)
See Installation below for setup instructions.
TUI Preview
Features
- Live TUI with real-time throughput graphs and per-stream stats
- Server dashboard -
xfr serve --tuifor monitoring active tests - Multi-client server - handle multiple simultaneous tests
- TCP, UDP, and QUIC with configurable bitrate pacing and parallel streams
- Firewall-friendly - single-port TCP, QUIC multiplexing, and
--cportfor pinning UDP/QUIC source ports - Bidirectional testing - measure upload and download simultaneously
- Multiple output formats - plain text, JSON, JSON streaming, CSV
- Result comparison -
xfr diffto detect performance regressions - LAN discovery - find xfr servers with mDNS (
xfr discover) - Prometheus metrics - export stats for monitoring dashboards
- Config file - save defaults in
~/.config/xfr/config.toml - Environment variables -
XFR_PORT,XFR_DURATIONoverrides
vs iperf3
| Feature | iperf3 | xfr |
|---|---|---|
| Live TUI | No | Yes (client & server) |
| Multi-client server | No | Yes |
| Firewall-friendly | --cport (TCP/UDP) |
Single-port TCP + --cport (UDP/QUIC) |
| Output formats | Text/JSON | Text/JSON/CSV |
| Prometheus metrics | No | Yes (optional feature) |
| Compare runs | No | xfr diff |
| LAN discovery | No | xfr discover |
| Config file | No | Yes |
Real-World Use Cases
VPN Tunnel Testing
Measure actual throughput through your VPN:
# On VPN server
# From client, through VPN
UDP Congestion Detection
Test UDP at your expected rate to detect packet loss:
Before/After Comparison
Quantify the impact of network changes:
# ... make changes ...
Multi-Stream for Bonded Connections
Test aggregate bandwidth across bonded/LACP interfaces:
Prometheus Monitoring
Continuous performance monitoring:
# Scrape metrics or view in Grafana
Installation
From crates.io (Recommended)
Requires Rust 1.88+:
# Install Rust (if not already installed)
|
# Install xfr
Homebrew (macOS/Linux)
Pre-built Binaries
Download from GitHub Releases:
| Platform | Target |
|---|---|
| Linux x86_64 | xfr-x86_64-unknown-linux-musl.tar.gz |
| Linux ARM64 | xfr-aarch64-unknown-linux-gnu.tar.gz |
| macOS Apple Silicon | xfr-aarch64-apple-darwin.tar.gz |
| macOS Intel | Use cargo install xfr |
| Android (Termux) | xfr-aarch64-linux-android.tar.gz |
| Windows | Use WSL2 (native support is experimental) |
# Example: Linux x86_64
&&
From Source
&&
Quick Install Script
Note: Review scripts before piping to sh. See the install script source.
|
Termux (Android)
Download the aarch64-linux-android binary from releases, or build from source:
NetBSD
Available via pkgsrc:
Optional Features
| Feature | Default | Description |
|---|---|---|
discovery |
Yes | mDNS LAN discovery (xfr discover) |
prometheus |
No | Prometheus metrics endpoint and Push Gateway support |
Shell Completions
# Bash
# Zsh (add ~/.zfunc to fpath in .zshrc first)
# Fish
# PowerShell (add to $PROFILE)
# Elvish
Usage
Server
Client
UDP Mode
QUIC Mode
QUIC provides built-in TLS 1.3 encryption with stream multiplexing over a single connection.
Security Note: QUIC encrypts traffic but does not verify server identity by default. For authenticated connections, use --psk on both client and server to prevent MITM attacks.
Output Formats
Note: Log messages go to stderr, allowing clean JSON/CSV piping: xfr <host> --json 2>/dev/null
Interval Control
Compare Results
Discovery
Keybindings (Client TUI)
| Key | Action |
|---|---|
q |
Quit (cancels test) |
p |
Pause/Resume display |
s |
Settings modal |
t |
Cycle color theme |
d |
Toggle per-stream view |
? / F1 |
Help |
j |
Print JSON result |
u |
Dismiss update notification |
Keybindings (Server TUI)
| Key | Action |
|---|---|
q |
Quit server |
? / F1 |
Help |
Esc |
Close help |
Themes
xfr includes 11 built-in color themes. Select with --theme or press t during a test:
Available themes: default, kawaii, cyber, dracula, monochrome, matrix, nord, gruvbox, catppuccin, tokyo_night, solarized
Your theme preference is auto-saved to ~/.config/xfr/prefs.toml.
Configuration
xfr reads defaults from ~/.config/xfr/config.toml:
[]
= 10
= 1
= false
= false
= false
= "default" # or dracula, catppuccin, nord, matrix, etc.
= "relative" # or "iso8601", "unix"
= "~/.config/xfr/xfr.log"
= "info"
[]
= 5201
= "http://pushgateway:9091"
= "~/.config/xfr/xfr-server.log"
= "info"
= "my-secret-key"
= 5
= ["192.168.0.0/16", "10.0.0.0/8"]
Environment variables override config file:
Prometheus Metrics
Enable with --features prometheus:
Metrics available at http://localhost:9090/metrics:
xfr_bytes_total- Total bytes transferredxfr_throughput_mbps- Current throughputxfr_active_tests- Number of active testsxfr_retransmits_total- TCP retransmissions
See examples/grafana-dashboard.json for a sample Grafana dashboard.
CLI Reference
| Flag | Short | Default | Description |
|---|---|---|---|
--port |
-p |
5201 | Server/client port |
--time |
-t |
10s | Test duration (use 0 for infinite) |
--udp |
-u |
false | UDP mode |
--quic |
-Q |
false | QUIC mode (encrypted, multiplexed streams) |
--bitrate |
-b |
unlimited | Target bitrate for TCP and UDP (e.g., 1G, 100M). 0 = unlimited |
--parallel |
-P |
1 | Parallel streams |
--reverse |
-R |
false | Reverse direction (download) |
--bidir |
false | Bidirectional test | |
--ipv4 |
-4 |
false | Force IPv4 only |
--ipv6 |
-6 |
false | Force IPv6 only |
--bind |
none | Local address to bind (e.g., 192.168.1.100) | |
--cport |
none | Client source port for firewall traversal (UDP/QUIC) | |
--json |
false | JSON output | |
--json-stream |
false | JSON per interval | |
--csv |
false | CSV output | |
--quiet |
-q |
false | Summary only |
--interval |
-i |
1.0 | Report interval (seconds) |
--omit |
0 | Omit first N seconds | |
--output |
-o |
stdout | Output file |
--no-tui |
false | Disable TUI | |
--theme |
default | Color theme (dracula, nord, matrix, etc.) | |
--tcp-nodelay |
false | Disable Nagle algorithm | |
--window |
OS default | TCP window size | |
--congestion |
OS default | TCP congestion control algorithm (e.g. cubic, bbr, reno) | |
--timestamp-format |
relative | Timestamp format (relative, iso8601, unix) | |
--log-file |
none | Log file path (e.g., ~/.config/xfr/xfr.log) | |
--log-level |
info | Log level (error, warn, info, debug, trace) | |
--push-gateway |
none | Prometheus Push Gateway URL (server) | |
--prometheus |
none | Prometheus metrics port (server, requires feature) | |
--psk |
none | Pre-shared key for authentication | |
--psk-file |
none | Read PSK from file | |
--rate-limit |
none | Max concurrent tests per IP (server) | |
--rate-limit-window |
60s | Rate limit time window (server) | |
--completions |
none | Generate shell completions (bash, zsh, fish, powershell, elvish) | |
--allow |
none | Allow IP/subnet, repeatable (server) | |
--deny |
none | Deny IP/subnet, repeatable (server) | |
--acl-file |
none | ACL rules file (server) | |
--max-duration |
none | Maximum test duration, server-side limit (server) | |
--tui |
false | Enable live dashboard (server) | |
--one-off |
false | Exit after one test (server, works with TCP and QUIC) |
Security Considerations
Transport Encryption
| Mode | Encryption | Certificate Verification |
|---|---|---|
| TCP | None | N/A |
| UDP | None | N/A |
| QUIC | TLS 1.3 | Disabled by default |
QUIC mode (-Q/--quic) provides TLS 1.3 encryption but does not verify server certificates, making it vulnerable to MITM attacks without additional authentication. Always use --psk with QUIC on untrusted networks. Alternatively, use a VPN or SSH tunnel.
Authentication
PSK authentication (--psk) verifies client identity but does not encrypt TCP/UDP traffic. For encrypted + authenticated connections, use QUIC with PSK:
# Server
# Client (encrypted + authenticated)
Network Considerations
- Single-port TCP: TCP uses single-port mode by default -- control and data connections share port 5201. Data connections are validated against the control connection's IP address, preventing unauthorized access.
- UDP on untrusted networks: UDP mode may be susceptible to reflection attacks from spoofed source addresses. Use TCP or QUIC on public networks.
- Rate limiting: Use
--rate-limiton public servers to prevent abuse. - ACLs: Use
--allow/--denyto restrict client access.
DoS Protections
- Slow-loris resistance: New connections must send their first message within 5 seconds, preventing slow-loris attacks from blocking the accept loop.
- DataHello flood protection: DataHello messages for unknown test IDs are rejected immediately without allocating resources.
- Bounded reads: All control messages are limited to 8KB, preventing memory exhaustion from oversized messages.
- Capability negotiation: Client and server exchange capabilities during the Hello handshake (protocol version 1.1), enabling safe feature evolution.
- Concurrent connection limits: Server limits concurrent handlers (default 100) to prevent connection floods.
Server Resource Usage
Each stream allocates 128KB-4MB for buffers depending on speed mode. Memory usage scales with concurrent clients:
| Streams per client | Memory per client | 10 clients |
|---|---|---|
1 (-P 1) |
128KB - 4MB | 1.3MB - 40MB |
8 (-P 8) |
1MB - 32MB | 10MB - 320MB |
128 (-P 128) |
16MB - 512MB | 160MB - 5GB |
The server limits concurrent handlers (default 100) to prevent resource exhaustion. Use --rate-limit to restrict tests per IP.
Platform Support
| Platform | Status |
|---|---|
| Linux x86_64/ARM64 | Full support, pre-built binaries |
| macOS Apple Silicon | Full support, pre-built binaries |
| macOS Intel | Full support, build from crate: cargo install xfr |
| Android (Termux) | Full support, pre-built binaries |
| NetBSD | Full support, via pkgsrc: pkgin install xfr |
| Windows | Experimental (WSL2 recommended). Native builds work but lack TCP_INFO metrics. |
Troubleshooting
Permission denied on port 5201
Use a port above 1024 or run with elevated privileges:
Connection refused
Ensure the server is running and the port is not blocked by a firewall. TCP only requires port 5201 (or your custom port) to be open -- no additional ephemeral data ports are needed. For UDP behind strict firewalls, use --cport to pin client source ports, or use QUIC which multiplexes on a single port.
Low throughput
- Try multiple parallel streams:
-P 4 - Disable Nagle's algorithm:
--tcp-nodelay - Increase TCP window size:
--window 4M
UDP packet loss
- Reduce bitrate:
-b 500M - Check for network congestion or firewall issues
Documentation
- Comparison with iperf3 - Feature matrix and migration guide
- Scripting & CI/CD - Automation, Docker, Prometheus
- Features Reference - Detailed feature documentation
- Architecture - For contributors
- Changelog - Release history
- Known Issues - Edge cases and limitations
- Roadmap - Planned features
- Contributing - Development guidelines
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.