〰️ 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
&&
Docker
Nix
Usage
# Fetch traceroute results from the RIPE Atlas API
# Convert from the standard input to the standard output
|
# Convert from a file to a file
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:
CustomTracerouteReaderwhich implements theIterator<Item = Result<Traceroute>>trait.CustomTracerouteWriterwhich implements theTracerouteWritertrait, and in particular thefn write_traceroute(&mut self, traceroute: &Traceroute) -> Result<()>function whereTracerouteis 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:
CustomFormattoTracerouteconversion in ato_internalmodule:impl From<CustomFormat> for Traceroute { ... }
CustomFormatfromTracerouteconversion in afrom_internalmoduleimpl From<Traceroute> for CustomFormat { ... }- or
impl From<Traceroute> for Vec<CustomFormat> { ... }ifCustomFormatis a single path traceroute format