# IPMapper Live site: https://labs.anaskhan.me/ipmapper/ Python repository: https://github.com/anxkhn/IPMapper Rust repository: https://github.com/anxkhn/ipmapper-rs PyPI package: https://pypi.org/project/ipmapper/ ## Overview IPMapper provides sub-microsecond offline IPv4 and IPv6 geolocation (ISO 3166-1 alpha-2 country code, country name, ISO 4217 currency) built from official Regional Internet Registry (RIR) delegated files, paired with an interactive global RIR map and hosted Cloudflare Pages Functions edge API. ## Python package (`ipmapper` v2.0.0) - Flattens 250k+ RIR CIDRs into disjoint sorted interval arrays (`array('I')` for IPv4, `array('Q')` for IPv6 upper 64 bits) with exact longest-prefix matching and `socket.inet_pton` + C-speed `bisect_right`. - Measured performance on the full 5-RIR dataset: 515 KB bundled snapshot (`prefixes.bin.gz`), ~4.2 ms cold load, ~2.0 MB RAM, ~2.2M lookups/sec (~0.45 us/lookup). - Air-gapped ready out of the box: `pip install ipmapper` or `pip install "ipmapper[full]"` (adds optional MMDB binary export). Supports `ipmapper export-bundle` and `ipmapper import-bundle` with strict ZIP allowlists, streamed byte caps, and SHA256/CRC32 verification. - Built-in internal HTTP microservice: `ipmapper serve --host 127.0.0.1 --port 8080` exposing `GET /lookup/`, `GET /lookup?ip=`, `POST /batch`, `GET /health`, and `GET /stats`. ## Rust port (`ipmapper-rs` v2.0.0) - Native Rust drop-in library crate, CLI, and multi-threaded HTTP microservice with full byte-for-byte snapshot parity (`IPMP` v1, 0 mismatches across 84,012 differential lookups). - Measured performance: 3.4 MB standalone binary, 3.3 ms cold load, 1.92 MB index RAM, ~83M IPv4 / ~95M IPv6 / ~9M full string lookups/sec. - Embeds the same 515 KB `prefixes.bin.gz` snapshot inside the binary for zero-config air-gapped deployments. ## Web explorer and edge API - `/ipmapper/`: Atlas-sheet homepage with live visitor IP probe, inline IPv4/IPv6 tester, interactive 5-RIR world map, and Python/Rust integration docs. - `/ipmapper/check.html`: Dedicated dual-stack IPv4/IPv6 tester. - `/ipmapper/format.html`: IPv4, IPv6 normal/dual, and CIDR subnet reference. - `/ipmapper/interview-prep.html`: 50 searchable networking interview questions. - `/ipmapper/api/me`: Cloudflare Pages Function returning caller IP, country, currency, RIR, ISP, ASN, and timezone. - `/ipmapper/api/lookup?ip=`: Edge-cached RIR delegated lookup JSON endpoint.