Crates.io | iplocate |
lib.rs | iplocate |
version | 0.1.0 |
source | src |
created_at | 2018-09-24 01:38:45.741685 |
updated_at | 2018-09-24 01:38:45.741685 |
description | A powerful IP geolocation API |
homepage | |
repository | https://github.com/rustka/iplocate |
max_upload_size | |
id | 86253 |
size | 9,601 |
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.
Licensed under either of
at your option.
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.