#geo-ip #ip #geolocation #domain #ip-address

ip_api

Library to get information about IP addresses or domains using ip-api.com

4 releases

Uses old Rust 2015

0.1.3 Jun 8, 2018
0.1.2 Oct 27, 2017
0.1.1 Oct 27, 2017
0.1.0 Oct 27, 2017

#281 in Geospatial

MIT license

10KB
163 lines

rust-ip_api

Travis Build Status Crates.io License

Library to get information about IP addresses or domains using http://ip-api.com. Documentation is here.

NOTE: I have not tested this with the commercial features. If you have let me know in an issue.


lib.rs:

It's rate limited and HTTPS access is a paid feature. If the rate limiter catches you going over the 150 requests per minute you will be banned by IP until you unban yourself. You can also view overall usage statistics here.

This information is likely not exact. Take this data with a grain of salt.

Example

extern crate ip_api;

use ip_api::GeoIp;

let fb = match GeoIp::new("www.facebook.com", false) {
    Err(e) => {
        eprintln!("{}", e);
        return;
    },
    Ok(geo_ip) => geo_ip
};

println!("{}", fb.country().unwrap());

Dependencies

~5–13MB
~184K SLoC