Expand description
IP2Location / IP2Proxy BIN database reader.
Provides zero-copy, memory-mapped lookups against IP2Location and IP2Proxy BIN databases.
§Quick start
use ip2location::{DB, Record};
let db = DB::from_file("data/IP2LOCATION-LITE-DB1.BIN").unwrap();
let record = db.ip_lookup("8.8.8.8".parse().unwrap()).unwrap();
println!("{:#?}", record);The database file is memory-mapped at open time and string fields in
returned records borrow directly from the mapped region (Cow::Borrowed),
avoiding heap allocation on the hot path.
Modules§
- error
- Error types returned by database operations.
Structs§
- LocationDB
- An opened IP2Location geolocation BIN database.
- Location
Record - Geolocation record returned by an IP2Location database lookup.
- ProxyDB
- An opened IP2Proxy proxy-detection BIN database.
- Proxy
Record - Proxy detection record returned by an IP2Proxy database lookup.