geoip 0.0.11

Bindings for the GeoIP library
Documentation

rust-geoip

GeoIP bindings for Rust.

Work in progress. Currently only supports the free ASN database.

Installation: use Cargo.

Usage:

let geoip = GeoIP::open(&Path::new("/opt/geoip/GeoIPASNum.dat"),
                        GeoIP::Options::MemoryCache).unwrap();
let ip = IpAddr::V4("91.203.184.192".parse().unwrap());
let res = geoip.as_info_by_ip(ip).unwrap();
assert!(res.asn == 41064);
assert!(res.name.contains("Telefun"));
assert!(res.netmask == 22);