Crates.io | asnames |
lib.rs | asnames |
version | 0.1.0 |
source | src |
created_at | 2023-05-26 18:02:45.824348 |
updated_at | 2023-05-26 18:02:45.824348 |
description | A library for simple Autonomous System (AS) names and country lookup |
homepage | |
repository | https://github.com/bgpkit/asnames-rs |
max_upload_size | |
id | 875218 |
size | 5,814 |
Simple Autonomous System (AS) names and country lookup Rust library
#[derive(Debug, Clone)]
pub struct AsName {
pub asn: u32,
pub name: String,
pub country: String,
}
use std::collections::HashMap;
use asnames::{AsName, load_asnames};
let asnames: HashMap<u32, AsName> = load_asnames().unwrap();
assert_eq!(asnames.get(&3333).unwrap().name, "RIPE-NCC-AS Reseaux IP Europeens Network Coordination Centre (RIPE NCC)");
assert_eq!(asnames.get(&400644).unwrap().name, "BGPKIT-LLC");
assert_eq!(asnames.get(&400644).unwrap().country, "US");