Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
/ cymrust Public archive

A Rust library to query Team Cymru's IP-to-ASN mapping information via DNS

License

Notifications You must be signed in to change notification settings

HowNetWorks/cymrust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cymrust Crates.io docs.rs CircleCI

Simple library to query Team Cymru's IP-to-ASN mapping information via DNS.

Please, see Team Cymru's documentation before using this library.

Cymrust's docs can be found from docs.rs.

Example

use std::env;
use std::net::IpAddr;

fn main() {
    let first_arg = env::args().nth(1).unwrap();
    let ip: IpAddr = first_arg.parse().unwrap();

    let cymru = cymrust::cymru_ip2asn(ip);
    println!("{:#?}", cymru)
}
$ cargo run -q --example whois 8.8.8.8
Ok(
    [
        CymruIP2ASN {
            ip_addr: V4(
                8.8.8.8
            ),
            bgp_prefix: "8.8.8.0/24",
            as_number: 15169,
            as_name: "GOOGLE - Google Inc., US",
            country_code: "US",
            registry: "arin",
            allocated: None,
            expires: SystemTime {
                tv_sec: 1483648521,
                tv_nsec: 906456000
            }
        }
    ]
)

About

A Rust library to query Team Cymru's IP-to-ASN mapping information via DNS

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages