1 unstable release

Uses old Rust 2015

0.1.0 Sep 24, 2018

#22 in #ip-geolocation

MIT/Apache

10KB
172 lines

IPLocate

Build Status

IPLocate.io is an internet service for finding data associated with Internet Protocol (IP) addresses, such as city, country, approximate location, timezone, and more.

Before starting to use their service, take a look at their terms of service.

The iplocate crate provides a wrapper for IPLocate API, and it can be handled with ease!

extern crate iplocate;

fn main() {
    let ip = "8.8.8.8".parse().unwrap();
    let result = iplocate::lookup(ip).unwrap();
    if let Some(ref country) = &result.geo_ip.country {
        println!("The IP address {} comes from the {}.", ip, country);
    } else {
        println!("The IP address {} does not belong to any country.", ip);
    }
}

You can find more examples in the examples directory.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~23MB
~471K SLoC