pub struct BgpkitCommons { /* private fields */ }
Implementations§
Source§impl BgpkitCommons
impl BgpkitCommons
pub fn as2rel_lookup( &self, asn1: u32, asn2: u32, ) -> Result<(Vec<As2relBgpkitData>, Vec<As2relBgpkitData>)>
Source§impl BgpkitCommons
impl BgpkitCommons
Sourcepub fn asinfo_all(&self) -> Result<HashMap<u32, AsInfo>>
pub fn asinfo_all(&self) -> Result<HashMap<u32, AsInfo>>
Returns a HashMap containing all AS information.
§Returns
Ok(HashMap<u32, AsInfo>)
: A HashMap where the key is the ASN and the value is the corresponding AsInfo.Err
: If the asinfo is not loaded.
§Examples
use bgpkit_commons::BgpkitCommons;
let mut bgpkit = BgpkitCommons::new();
bgpkit.load_asinfo(false, false, false, false).unwrap();
let all_asinfo = bgpkit.asinfo_all().unwrap();
Sourcepub fn asinfo_get(&self, asn: u32) -> Result<Option<AsInfo>>
pub fn asinfo_get(&self, asn: u32) -> Result<Option<AsInfo>>
Retrieves AS information for a specific ASN.
§Arguments
asn
- The Autonomous System Number to look up.
§Returns
Ok(Some(AsInfo))
: The AS information if found.Ok(None)
: If the ASN is not found in the database.Err
: If the asinfo is not loaded.
§Examples
use bgpkit_commons::BgpkitCommons;
let mut bgpkit = BgpkitCommons::new();
bgpkit.load_asinfo(false, false, false, false).unwrap();
let asinfo = bgpkit.asinfo_get(3333).unwrap();
Sourcepub fn asinfo_are_siblings(&self, asn1: u32, asn2: u32) -> Result<bool>
pub fn asinfo_are_siblings(&self, asn1: u32, asn2: u32) -> Result<bool>
Checks if two ASNs are siblings (belong to the same organization).
§Arguments
asn1
- The first Autonomous System Number.asn2
- The second Autonomous System Number.
§Returns
Ok(bool)
: True if the ASNs are siblings, false otherwise.Err
: If the asinfo is not loaded or not loaded with as2org data.
§Examples
use bgpkit_commons::BgpkitCommons;
let mut bgpkit = BgpkitCommons::new();
bgpkit.load_asinfo(true, false, false, false).unwrap();
let are_siblings = bgpkit.asinfo_are_siblings(3333, 3334).unwrap();
§Note
This function requires the asinfo to be loaded with as2org data.
Source§impl BgpkitCommons
impl BgpkitCommons
pub fn bogons_match(&self, s: &str) -> Result<bool>
pub fn bogons_match_prefix(&self, prefix: &str) -> Result<bool>
pub fn bogons_match_asn(&self, asn: u32) -> Result<bool>
Sourcepub fn get_bogon_prefixes(&self) -> Result<Vec<BogonPrefix>>
pub fn get_bogon_prefixes(&self) -> Result<Vec<BogonPrefix>>
Get all bogon prefixes.
Sourcepub fn get_bogon_asns(&self) -> Result<Vec<BogonAsn>>
pub fn get_bogon_asns(&self) -> Result<Vec<BogonAsn>>
Get all bogon ASNs.
Source§impl BgpkitCommons
impl BgpkitCommons
Source§impl BgpkitCommons
impl BgpkitCommons
pub fn mrt_collectors_all(&self) -> Result<Vec<MrtCollector>>
pub fn mrt_collectors_by_name(&self, name: &str) -> Result<Option<MrtCollector>>
pub fn mrt_collectors_by_country( &self, country: &str, ) -> Result<Vec<MrtCollector>>
pub fn mrt_collector_peers_all(&self) -> Result<Vec<MrtCollectorPeer>>
pub fn mrt_collector_peers_full_feed(&self) -> Result<Vec<MrtCollectorPeer>>
Source§impl BgpkitCommons
impl BgpkitCommons
pub fn rpki_lookup_by_prefix(&self, prefix: &str) -> Result<Vec<RoaEntry>>
pub fn rpki_validate(&self, asn: u32, prefix: &str) -> Result<RpkiValidation>
pub fn rpki_validate_check_expiry( &self, asn: u32, prefix: &str, check_time: Option<NaiveDateTime>, ) -> Result<RpkiValidation>
Source§impl BgpkitCommons
impl BgpkitCommons
pub fn new() -> Self
Sourcepub fn loading_status(&self) -> Vec<(&'static str, &'static str)>
pub fn loading_status(&self) -> Vec<(&'static str, &'static str)>
Get loading status for all available modules
Sourcepub fn load_countries(&mut self) -> Result<()>
pub fn load_countries(&mut self) -> Result<()>
Load countries data
Sourcepub fn load_mrt_collectors(&mut self) -> Result<()>
pub fn load_mrt_collectors(&mut self) -> Result<()>
Load MRT mrt_collectors data
Sourcepub fn load_mrt_collector_peers(&mut self) -> Result<()>
pub fn load_mrt_collector_peers(&mut self) -> Result<()>
Load MRT mrt_collectors data
Sourcepub fn load_bogons(&mut self) -> Result<()>
pub fn load_bogons(&mut self) -> Result<()>
Load bogons data
Sourcepub fn load_asinfo(
&mut self,
load_as2org: bool,
load_population: bool,
load_hegemony: bool,
load_peeringdb: bool,
) -> Result<()>
pub fn load_asinfo( &mut self, load_as2org: bool, load_population: bool, load_hegemony: bool, load_peeringdb: bool, ) -> Result<()>
Load AS name and country data
pub fn load_asinfo_cached(&mut self) -> Result<()>
Sourcepub fn load_as2rel(&mut self) -> Result<()>
pub fn load_as2rel(&mut self) -> Result<()>
Load AS-level relationship data
Trait Implementations§
Source§impl Default for BgpkitCommons
impl Default for BgpkitCommons
Source§fn default() -> BgpkitCommons
fn default() -> BgpkitCommons
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BgpkitCommons
impl RefUnwindSafe for BgpkitCommons
impl Send for BgpkitCommons
impl Sync for BgpkitCommons
impl Unpin for BgpkitCommons
impl UnwindSafe for BgpkitCommons
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more