1 unstable release
Uses old Rust 2015
0.1.0 | Sep 24, 2018 |
---|
#22 in #ip-geolocation
10KB
172 lines
IPLocate
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
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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