#bgp #ip #bgpkit #rpki #system-information #mrt #lookup

bgpkit-commons

A library for common BGP-related data and functions

15 unstable releases (6 breaking)

0.7.3 Oct 31, 2024
0.6.0 Jun 26, 2024
0.5.2 Mar 21, 2024
0.4.3 Nov 29, 2023

#1354 in Network programming

Download history 4/week @ 2024-08-10 11/week @ 2024-08-17 2/week @ 2024-08-24 13/week @ 2024-09-21 230/week @ 2024-09-28 151/week @ 2024-10-05 102/week @ 2024-10-12 3/week @ 2024-10-19 88/week @ 2024-10-26 65/week @ 2024-11-02 5/week @ 2024-11-09 6/week @ 2024-11-16 2/week @ 2024-11-23

109 downloads per month
Used in bgpkit-broker

MIT license

77KB
2K SLoC

BGPKIT Commons

This readme is generated from the library's doc comments using cargo-readme. Please refer to the Rust docs website for the full documentation

Crates.io Docs.rs License Discord

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 APIs
  • asinfo: Autonomous System (AS) information and country lookup
  • countries: country code to name and other information lookup
  • rpki: RPKI validation data. Historical data from RIPE NCC and real-time data from Cloudflare
  • bogons: IP prefix and ASN bogon lookup
  • as2rel: 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:

  1. create a mutable BgpkitCommons instance
  2. load the data you need by calling bgpkit.load_xxx() functions
  3. 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 requests
  • native-tls: use native-tls as the backend

License

MIT

Dependencies

~6–23MB
~375K SLoC