originet/lib.rs
1//! Map IP addresses to origin ASNs with CAIDA's RouteViews prefix-to-AS snapshots.
2//!
3//! The crate is a thin library under the `originet` binary:
4//!
5//! - [`pfx2as`] parses the `pfx2as` text format CAIDA publishes;
6//! - [`table`] holds a longest-prefix-match table for IPv4 and IPv6;
7//! - [`caida`] knows the dataset layout on `publicdata.caida.org` and picks a snapshot by date;
8//! - [`fetch`] downloads the index and the snapshots into a local cache;
9//! - [`cache`] lists what the cache holds and prunes it;
10//! - [`load`] fills a table from a local file or from CAIDA and records where it came from;
11//! - [`input`] reads and validates the addresses to look up;
12//! - [`output`] serializes results as JSON, JSON Lines, CSV, TSV or Parquet.
13
14pub mod cache;
15pub mod caida;
16pub mod fetch;
17pub mod input;
18pub mod load;
19pub mod output;
20pub mod pfx2as;
21pub mod table;
22
23/// The crate version, as compiled into the binary.
24pub const VERSION: &str = env!("CARGO_PKG_VERSION");
25
26/// The `User-Agent` sent to CAIDA, so the data host can tell who is downloading.
27pub const USER_AGENT: &str = concat!(
28 "originet/",
29 env!("CARGO_PKG_VERSION"),
30 " (+https://github.com/estcarisimo/originet)"
31);