Expand description
§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!
let ip = "8.8.8.8".parse().unwrap();
let result = iplocate::lookup(ip)?;
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);
}
Structs§
- GeoIp
- This type contains all the data related to a specific IP address.
- IpLocate
- The preferred return type of a request.
- Lookup
- This type allows customization of
lookup
function. - Rate
Limit - This type contains all the data associated with IPLocate API’s rate limits.
Enums§
- Format
- The format of the data to be returned upon request from the IPLocate API.
Functions§
Type Aliases§
- Result
- An alias for
reqwest::Result
in which it will result in error in case of a failed HTTP request.