use asn_db2::Ipv6Database; use std::{fs::File, io::BufReader, net::Ipv6Addr, str::FromStr}; fn main() -> Result<(), Box> { let database = { let reader = BufReader::new(File::open("ip2asn-v6.tsv")?); Ipv6Database::from_reader(reader)? }; let ips = [ "2606:4700:4700::1111", "2606:4700:4700::1001", "2a05:dfc2::", "2a05:dfc3:cafe::", ]; for ip in ips { let ip = Ipv6Addr::from_str(ip)?; let asn = database.lookup(ip).unwrap(); println!("{:#?}", asn); } Ok(()) }