8 releases (4 breaking)
0.6.2 | Mar 5, 2023 |
---|---|
0.6.1 | Mar 5, 2023 |
0.5.1 | Dec 9, 2022 |
0.5.0 | Aug 24, 2022 |
0.2.0 | May 2, 2022 |
#1151 in Network programming
24 downloads per month
69KB
1K
SLoC
〰️ pantrace
Pantrace converts between traceroute formats, in the same way as Pandoc converts between document formats.
Each format needs to implement only two conversions: to and from the internal format.
Quickstart
Cargo
cargo install pantrace && pantrace --help
Docker
docker run ghcr.io/dioptra-io/pantrace:main --help
Nix
nix run github:dioptra-io/pantrace -- --help
Usage
# Fetch traceroute results from the RIPE Atlas API
curl -L -o example.ndjson \
"https://atlas.ripe.net/api/v2/measurements/23119199/results/?start=1625097600&stop=1625788799&format=txt&probe_ids=6479"
# Convert from the standard input to the standard output
cat example.ndjson | pantrace --standalone --from atlas --to scamper-trace-warts > example.warts
# Convert from a file to a file
pantrace --standalone --from atlas --to scamper-trace-warts --input example.ndjson --output example.warts
Formats
atlas
: RIPE Atlas JSONL (read/write)flat
: JSONL with one document per reply (write-only)internal
: Pantrace internal format (read/write)iris
: Iris JSONL format (read/write)scamper-trace-warts
: Scamper traceroute in warts format (read/write)
Implementing a new format
To add a new CustomFormat
to the pantrace CLI (main.rs
), two structures must be implemented:
CustomTracerouteReader
which implements theIterator<Item = Result<Traceroute>>
trait.CustomTracerouteWriter
which implements theTracerouteWriter
trait, and in particular thefn write_traceroute(&mut self, traceroute: &Traceroute) -> Result<()>
function whereTraceroute
is pantrace's internal traceroute format.
The conversion between CustomFormat
and Traceroute
can be implemented in any way, but the current formats are
implemented as follows:
CustomFormat
toTraceroute
conversion in ato_internal
module:impl From<CustomFormat> for Traceroute { ... }
CustomFormat
fromTraceroute
conversion in afrom_internal
moduleimpl From<Traceroute> for CustomFormat { ... }
- or
impl From<Traceroute> for Vec<CustomFormat> { ... }
ifCustomFormat
is a single path traceroute format
Dependencies
~6.5MB
~126K SLoC