IP2Location & IP2Proxy
This library reads the IP2Location DB format for both IP2Location and IP2Proxy and returns geo information for the given IP.
Features
- Zero-copy — string fields borrow directly from the memory-mapped file
- Memory-mapped I/O — database is mmap’d at open time, no heap allocation on the lookup path
- Supports both IP2Location (geolocation) and IP2Proxy (proxy detection) BIN databases
- Handles IPv4, IPv6, 6to4, Teredo, and IPv4-mapped IPv6 addresses
Requirements
- Rust 1.85+ (edition 2024)
Building
- debug
- release
Testing
Usage
[]
= "0.6"
Example
use ;
const IPV4BIN: &str = "data/IP2LOCATION-LITE-DB1.BIN";
const IPV6BIN: &str = "data/IP2LOCATION-LITE-DB1.IPV6.BIN";
const IP2PROXYBIN: &str = "data/IP2PROXY-IP-COUNTRY.BIN";
// Lookup an IPv4 in the IP2Location IPv6 BIN Database
// Lookup an IPv4 in the IP2Location IPv4 BIN Database
// Lookup an IP in the Proxy Database
Executing the Example
# IP2Location Example
# IP2Proxy Example
License
This is free software, licensed under the MIT license.
Ip2Location Databases:
- Lite free version: Free
- Ip2Location / Ip2Proxy: Commercial
Sriram