IP2Proxy Rust Library

Test crates.io docs.rs

Library to query IP2Proxy BIN Data files. They contain known proxies, geolocation information, and other meta data for IP address ranges.

https://www.ip2location.com/ is a commercial provider, offering various database files for download.

Supports IPv4 and IPv6.

Usage example

```rust use ip2proxy::{Columns, Database, Row};

let db = Database::open("data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN")?;

asserteq!(db.packageversion(), 11); asserteq!(db.databaseversion(), "21.5.28");

if let Some(row) = db.query("1.0.0.1".parse()?, Columns::all())? { asserteq!(row.proxytype, Some(String::from("DCH"))); asserteq!(row.countryshort, Some(String::from("US"))); asserteq!(row.countrylong, Some(String::from("United States of America"))); asserteq!(row.region, Some(String::from("California"))); asserteq!(row.city, Some(String::from("Los Angeles"))); asserteq!(row.isp, Some(String::from("APNIC and CloudFlare DNS Resolver Project"))); asserteq!(row.domain, Some(String::from("cloudflare.com"))); asserteq!(row.usagetype, Some(String::from("CDN"))); asserteq!(row.asn, Some(String::from("13335"))); asserteq!(row.asname, Some(String::from("CloudFlare Inc"))); asserteq!(row.lastseen, Some(String::from("27"))); asserteq!(row.threat, Some(String::from("-"))); assert_eq!(row.provider, Some(String::from("-"))); } ```

Documentation

Read the documentation

License

This is an independently developed open-source library, licensed under the MIT or Apache 2.0 license at your option. The author is not associated with IP2Location.com.