[][src]Crate ip2proxy

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.

Example

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

let db = Database::open("data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")?;

let row = db.query("1.0.0.1".parse()?, Columns::all())?;

assert_eq!(row, Some(Row {
    proxy_type: Some(String::from("DCH")),
    country_short: Some(String::from("AU")),
    country_long: Some(String::from("Australia")),
    region: Some(String::from("Queensland")),
    city: Some(String::from("Brisbane")),
    isp: Some(String::from("Research Prefix for APNIC Labs")),
    ..Row::default()
}));

Cargo features

  • serde: Implement serde::Serialize and serde::Deserialize for Row.

Structs

Columns

Set of supported or selected columns.

Database

An IP2Proxy BIN database.

Header

A database header with meta information.

Row

Database record for an IP address.