IP2Location & IP2Proxy

Crates.io Documentation

Linux Arm7 Linux x86<em>64 macOS x86</em>64 Windows x86_64

This library reads the IP2Location DB format for both IP2Location and IP2Proxy and returns geo information for the given IP.

Requirements

Building

Testing

bash cargo t -v

Usage

toml [dependencies] ip2location = "0.3.1"

Executing the Example

```bash cargo b --example

IP2Lcoation Example

./target/debug/examples/lookup data/IP2LOCATION-LITE-DB1.IPV6.BIN 2a01:cb08:8d14:: Db Path: data/IP2LOCATION-LITE-DB1.IPV6.BIN |- Db Type: 1 |- Db Column: 2 |- Db Date (YY/MM/DD): 20/12/28

Ok( Record { ip: "2a01:cb08:8d14::", latitude: None, longitude: None, country: Some( Country { shortname: "FR", longname: "France", }, ), region: None, city: None, isp: None, domain: None, zipcode: None, timezone: None, netspeed: None, iddcode: None, areacode: None, weatherstationcode: None, weatherstationname: None, mcc: None, mnc: None, mobilebrand: None, elevation: None, usagetype: None, addresstype: None, category: None, }, )

IP2Proxy Example

./target/debug/examples/lookup data/sample.bin.px11/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN 194.59.249.19 Db Path: data/sample.bin.px11/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER.BIN |- Db Type: 11 |- Db Column: 13 |- Db Date (YY/MM/DD): 21/5/28

ProxyDb( ProxyRecord { ip: 1.1.1.1, country: Some( Country { shortname: "US", longname: "United States of America", }, ), region: Some( "California", ), city: Some( "Los Angeles", ), isp: Some( "APNIC and CloudFlare DNS Resolver Project", ), domain: Some( "cloudflare.com", ), isproxy: Some( IsAProxy, ), proxytype: Some( "US", ), asn: Some( "13335", ), as: Some( "CloudFlare Inc", ), lastseen: Some( "27", ), threat: Some( "-", ), provider: Some( "-", ), usage_type: Some( "CDN", ), }, ) ```

License

This is free software, licensed under the MIT license.

Ip2Location Databases:


Sriram