The Problem
Operators need a single tool that shows hop‑by‑hop latency, loss, and path characteristics without juggling separate traceroute and ping utilities. When a network segment behaves erratically, pinpointing the offending hop can be time‑consuming and error‑prone.
What This Does
trippy combines traceroute‑style path discovery with continuous ping‑style probing, presenting the data in a terminal UI (TUI). The core logic lives in the crates/trippy-core library (src/lib.rs, src/tracer.rs, src/probe.rs). The UI layer in crates/trippy-tui renders the results (frontend/render/*.rs). Platform‑specific socket handling is isolated in crates/trippy-core/src/net/platform/*. DNS resolution is provided by crates/trippy-dns (src/resolver.rs). All crates are assembled into the binary defined in the top‑level Cargo.toml (crate trippy).
How It Is Wired
- Entry point –
cargo run --bin trippybuilds the binary declared in the rootCargo.toml. Themainfunction (generated by Cargo) pulls intrippy-core::libandtrippy-tui::app.
- Core initialization –
trippy-core/src/lib.rsexposesBuilder::new()which reads the configuration (src/config.rs) and creates aTracer.
- Tracer construction –
src/tracer.rscreates aStrategy(src/strategy.rs) that selects the probe type (ICMP, UDP, or TCP) and the hop‑selection algorithm (classic, Paris, Dublin).
- Network I/O –
src/net/*.rsimplementsChannelabstractions. Platform‑specific modules (platform/unix.rs,platform/windows.rs) open raw sockets (viasocket.rs) and apply required privileges (crates/trippy-privilege).
- Probe loop –
src/probe.rsdrives the per‑hop send/receive cycle, updating a sharedState(src/state.rs). The state is consumed by the TUI.
- DNS – When the user enables host name resolution,
trippy-dns::Resolver(src/resolver.rs) performs asynchronous lookups usinglazy_resolver.rs.
- UI rendering –
trippy-tui/src/frontend/render/*.rsread theStateand draw tables, charts, and maps. The rendering pipeline is triggered by a tick loop infrontend/tui_app.rs.
- Reporting – Optional output formats (JSON, CSV, DOT) are implemented in
trippy-tui/src/report/*.rsand invoked from the command‑line parser (src/config/cmd.rs).
Key hubs – trippy-core/src/lib.rs and trippy-tui/src/app.rs are the widest‑impact files; changes here cascade to most other modules. The platform layer is a clear isolation point, so extending support for a new OS only touches src/net/platform/*. No circular dependencies are evident in the current crate graph.
How To Use It
# Clone the repo
git clone https://github.com/moses-y/trippy
cd trippy
# Build the binary (requires Rust toolchain)
cargo build --release
# Run the default tracer (ICMP, 30 hops, 5 probes per hop)
./target/release/trippy
# Example with DNS resolution and JSON output
./target/release/trippy --resolve --output json > result.json
Docker – a ready‑to‑run image can be built with the supplied Dockerfile:
docker build -t trippy .
docker run --rm -it trippy --help
Configuration files (crates/trippy-core/src/config.rs, crates/trippy-tui/src/config/file.rs) read a TOML file at $HOME/.config/trippy/config.toml if present; otherwise defaults are used. No environment variables are required out‑of‑the‑box.
Real‑World Use
A monitoring server can invoke trippy nightly to capture a baseline path to a critical endpoint, store the JSON output, and diff it against the previous run to detect new hops or latency spikes:
#!/usr/bin/env bash
trippy --output json www.example.com > /var/lib/trippy/$(date +%F).json
The JSON can be parsed by a Grafana data source to surface regressions in a dashboard.
Code Health & Issues
- Low – Duplicate simulation data – many
.tomlfiles undercrates/trippy-core/tests/resources/simulation/repeat similar probe scenarios; could be consolidated. - Low – Large UI module –
crates/trippy-tui/src/frontend/rendercontains >30 files; a higher‑level abstraction might reduce boilerplate. - Low – No CI badge for Rust‑fmt – repository includes a CI workflow (
.github/workflows/ci.yml) but does not enforcecargo fmt.
No critical security or build‑breakage findings were detected in the static layout; licensing (LICENSE) and CI (.github/workflows/*) are present.
The Bottom Line
trippy delivers a well‑structured, Rust‑native combination of traceroute and ping with a feature‑rich TUI. The modular crate layout isolates platform code and DNS resolution, making extensions straightforward. Minor refactoring of the UI rendering layer could improve maintainability, but the project is ready for production use by network engineers needing a single, scriptable diagnostic tool.