-
Install Rust (1.88+):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Clone the repository:
git clone https://github.com/lance0/xfr.git cd xfr -
Build:
cargo build
-
Run tests:
cargo test --all-features
- Run
cargo fmtbefore committing - Run
cargo clippy --all-featuresand fix any warnings - Keep lines under 100 characters when possible
We ship a .pre-commit-config.yaml that runs cargo fmt and cargo clippy
on every commit and cargo test --lib on every push. Set it up once:
# Recommended: prek (fast Rust port, drop-in compatible)
cargo install --locked prek
prek install
# Or via standalone installer (no Rust toolchain needed)
curl -LsSf https://github.com/j178/prek/releases/latest/download/prek-installer.sh | sh
# Or with the original Python pre-commit
pipx install pre-commit
pre-commit install --hook-type pre-commit --hook-type pre-pushAfter install, hooks run automatically. To run them manually against staged
files: prek run (or pre-commit run).
# Run all tests
cargo test --all-features
# Run with specific feature
cargo test --features prometheus
# Run integration tests only
cargo test --test integration- Fork the repository
- Create a feature branch from
master - Make your changes
- Run
cargo fmtandcargo clippy --all-features - Ensure all tests pass
- Submit a pull request
| Flag | Description |
|---|---|
prometheus |
Enable Prometheus metrics endpoint |
discovery |
Enable mDNS LAN discovery (default) |
src/
├── main.rs # CLI entry point
├── lib.rs # Library exports
├── client.rs # Client implementation
├── serve.rs # Server implementation
├── protocol.rs # Control protocol messages
├── tcp.rs # TCP data transfer
├── udp.rs # UDP pacing and jitter
├── stats.rs # Test statistics
├── config.rs # Config file loading
├── diff.rs # Result comparison
├── discover.rs # mDNS discovery
├── tcp_info.rs # Platform TCP_INFO
├── tui/ # Terminal UI
│ ├── app.rs # App state
│ ├── ui.rs # Drawing
│ └── widgets.rs # Custom widgets
└── output/ # Output formats
├── plain.rs # Plain text
├── json.rs # JSON
└── prometheus.rs # Prometheus metrics
- New output format: Add to
src/output/and updatesrc/output/mod.rs - New protocol message: Add to
ControlMessageenum insrc/protocol.rs - New CLI flag: Add to
Clistruct insrc/main.rs - New config option: Add to
src/config.rsand updateexamples/config.toml
Open an issue on GitHub: https://github.com/lance0/xfr/issues