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

  1. Entry point – cargo run --bin trippy builds the binary declared in the root Cargo.toml. The main function (generated by Cargo) pulls in trippy-core::lib and trippy-tui::app.
  1. Core initialization – trippy-core/src/lib.rs exposes Builder::new() which reads the configuration (src/config.rs) and creates a Tracer.
  1. Tracer construction – src/tracer.rs creates a Strategy (src/strategy.rs) that selects the probe type (ICMP, UDP, or TCP) and the hop‑selection algorithm (classic, Paris, Dublin).
  1. Network I/O – src/net/*.rs implements Channel abstractions. Platform‑specific modules (platform/unix.rs, platform/windows.rs) open raw sockets (via socket.rs) and apply required privileges (crates/trippy-privilege).
  1. Probe loop – src/probe.rs drives the per‑hop send/receive cycle, updating a shared State (src/state.rs). The state is consumed by the TUI.
  1. DNS – When the user enables host name resolution, trippy-dns::Resolver (src/resolver.rs) performs asynchronous lookups using lazy_resolver.rs.
  1. UI rendering – trippy-tui/src/frontend/render/*.rs read the State and draw tables, charts, and maps. The rendering pipeline is triggered by a tick loop in frontend/tui_app.rs.
  1. Reporting – Optional output formats (JSON, CSV, DOT) are implemented in trippy-tui/src/report/*.rs and 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 .toml files under crates/trippy-core/tests/resources/simulation/ repeat similar probe scenarios; could be consolidated.
  • Low – Large UI module – crates/trippy-tui/src/frontend/render contains >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 enforce cargo 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.