This readme is generated from the library's doc comments using cargo-readme. Please refer to the Rust docs website for the full documentation
BGPKIT-Commons is a library for common BGP-related data and functions.
This crate provides three functions to retrieve the full list of MRT collectors from
RouteViews and RIPE RIS:
- get_routeviews_collectors()
- get_riperis_collectors()
- get_all_collectors()
The collectors are abstract to the following struct: ```rust use chrono::NaiveDateTime; use bgpkit_commons::collectors::MrtCollectorProject; /// MRT collector meta information
pub struct MrtCollector {
/// name of the collector
pub name: String,
/// collector project
pub project: MrtCollectorProject,
/// MRT data files root URL
pub dataurl: String,
/// collector activation timestamp
pub activatedon: NaiveDateTime,
/// collector deactivation timestamp (None for active collectors)
pub deactivated_on: Option
where `MrtCollectorProject` is defined as:
rust
pub enum MrtCollectorProject { RouteViews, RipeRis, } ```
See the following example for usage:
rust
use bgpkit_commons::collectors::get_routeviews_collectors;
fn main() {
println!("get route views collectors");
let mut routeviews_collectors = get_routeviews_collectors().unwrap();
routeviews_collectors.sort();
let earliest = routeviews_collectors.first().unwrap();
let latest = routeviews_collectors.last().unwrap();
println!("\t total of {} collectors", routeviews_collectors.len());
println!(
"\t earliest collector: {} (activated on {})",
earliest.name, earliest.activated_on
);
println!(
"\t latest collector: {} (activated on {})",
latest.name, latest.activated_on
);
}
asnames
is a module for Autonomous System (AS) names and country lookup
Data source: - https://ftp.ripe.net/ripe/asnames/asn.txt
```rust
pub struct AsName { pub asn: u32, pub name: String, pub country: String, } ```
```rust use std::collections::HashMap; use bgpkitcommons::asnames::{AsName, getasnames};
fn main() {
let asnames: HashMap
MIT