| Crates.io | cymrust |
| lib.rs | cymrust |
| version | 0.4.1 |
| created_at | 2017-01-05 12:57:00.361195+00 |
| updated_at | 2021-02-16 10:26:19.67602+00 |
| description | Query Team Cymru's IP-to-ASN mapping via DNS |
| homepage | https://github.com/HowNetWorks/cymrust#readme |
| repository | https://github.com/HowNetWorks/cymrust |
| max_upload_size | |
| id | 7934 |
| size | 34,756 |
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.
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
}
}
]
)