Expand description
§Overview
BGPKIT-Commons is a library for common BGP-related data and functions.
It provides the following modules:
mrt_collectors
: public RouteViews and RIPE RIS MRT mrt_collectors information extracted from their official APIsasinfo
: Autonomous System (AS) information and country lookupcountries
: country code to name and other information lookuprpki
: RPKI validation data. Historical data from RIPE NCC and real-time data from Cloudflarebogons
: IP prefix and ASN bogon lookupas2rel
: AS-level relationship data, generated by BGPKIT
§Basic Usage
Add bgpkit-commons
to your Cargo.toml
’s dependencies
section:
bgpkit-commons = "0.7"
bgpkit-commons
is designed to load only the data you need. Here is an example of checking if an ASN is a bogon ASN:
use bgpkit_commons::BgpkitCommons;
let mut bgpkit = BgpkitCommons::new();
bgpkit.load_bogons().unwrap();
assert!(bgpkit.bogons_match("23456").unwrap());
The common steps include:
- create a mutable
BgpkitCommons
instance - load the data you need by calling
bgpkit.load_xxx()
functions - use the data by calling the corresponding functions, named as
bgpkit.xxx_yyy()
For detailed usages, please refer to the module documentation.
§Feature Flags
rustls
(default): use rustls instead of native-tls for the underlying HTTPS requestsnative-tls
: use native-tls as the backend
Modules§
- AS-level relationship generated by BGPKIT
- asinfo is a module for simple Autonomous System (AS) names and country lookup
- Module: bogons
- Module: countries
- Module for getting meta information for the public MRT mrt_collectors.
- rpki module maintains common functions for accessing RPKI information