asnames

Crates.ioasnames
lib.rsasnames
version0.1.0
sourcesrc
created_at2023-05-26 18:02:45.824348
updated_at2023-05-26 18:02:45.824348
descriptionA library for simple Autonomous System (AS) names and country lookup
homepage
repositoryhttps://github.com/bgpkit/asnames-rs
max_upload_size
id875218
size5,814
Mingwei Zhang (digizeph)

documentation

https://docs.rs/bgpkit-parser

README

asnames-rs

Simple Autonomous System (AS) names and country lookup Rust library

Data source

Data definition

#[derive(Debug, Clone)]
pub struct AsName {
    pub asn: u32,
    pub name: String,
    pub country: String,
}

Usage

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");
Commit count: 4

cargo fmt