ip2region: Offline IP-to-Region localization library with 10-microsecond query efficiency (20k stars)
What it does
All text below is quoted directly from the project README.
>ip2region - is an offline IP address localization library and IP localization data management framework. It supports both IPv4 and IPv6 with query efficiency at the 10-microsecond level. It provides xdb data generation and query client implementations for many mainstream programming languages.
Features:
- Offline Localization Library: The project itself provides raw data for both IPv4 (data/ipv4_source.txt) and IPv6 (data/ipv6_source.txt), along with corresponding xdb files (data/ip2region_v4.xdb and data/ip2region_v6.xdb) to achieve city-level query localization. The field format is: Country|Province|City|ISP|iso-alpha2-code.
- Data Management Framework: xdb supports hundreds of millions of IP data segment rows. Region information supports full customization. You can append data for specific business needs to the region, such as: GPS information/International Standard Regional Codes/Zip codes, etc.
- Data Deduplication and Compression: The xdb format generation program automatically processes the input raw data, checks and completes the merging of adjacent IP segments, and performs deduplication and compression of identical regional information.
- High-Speed Query Response: Even for queries based entirely on the xdb file, the single query response time is at the 10-microsecond level.
- vIndex Index Caching: Uses a fixed 512KiB of memory to cache vector index data, reducing one disk IO operation and maintaining average query efficiency within 100 microseconds.
- Entire xdb File Caching: Loads the entire xdb file into memory. Memory usage is equal to the xdb file size. There is no disk IO operation, maintaining 10-microsecond level query efficiency.
- Unified Query Interface: xdb provides version-compatible query implementations. A unified API can simultaneously provide queries for both IPv4 and IPv6 data and return unified data.
>For API introductions, usage documentation, and test programs, please refer to the README introduction under the corresponding searcher query client.
Repository
lionsoul2014/ip2region
Repository stats
|Metric|Value|
|:-|:-|
|Stars|19,705|
|Forks|3,078|
|Last release|v3.18.0 (2026-09-08)|
|Languages|Go 18.9%, Java 18.6%, C 12.3%|
|Contributors|48|
|AI contributor accounts (Claude / Codex / Cursor / Copilot)|None|
|AI co-authored commits|None|
Main contributor
|Field|Value|
|:-|:-|
|Name|Leon|
|GitHub|@lionsoul2014|
|Commits to this repo|742 (top contributor)|
|Bio|A creative being.|
|Company / Location|Shenzhen, China|
|Followers|615|
|Public repos|14|
|On GitHub since|2014-03-31|
──────────────────────────────
📌 How many great GitHub repos have you discovered and completely forgotten about?
Don't let another useful tool disappear into your Reddit feed. Get the community's best repos, organized by category, plus key takeaways from real developer discussions, delivered to your inbox twice a week.
📬 Never lose track of great repos again. Subscribe free.
9 points
Mentions
ip2region: Offline IP-to-Region localization library with 10-microsecond query efficiency (20k stars) What it does All text below is quoted directly from the project README. >ip2region - is an offline IP address localization library and IP localization data management framework. It supports both IPv4 and IPv6 with query efficiency at the 10-microsecond level. It provides xdb data generation and query client implementations for many mainstream programming languages. Features: - Offline Localization Library: The project itself provides raw data for both IPv4 (data/ipv4_source.txt) and IPv6 (data/ipv6_source.txt), along with corresponding xdb files (data/ip2region_v4.xdb and data/ip2region_v6.xdb) to achieve city-level query localization. The field format is: Country|Province|City|ISP|iso-alpha2-code. - Data Management Framework: xdb supports hundreds of millions of IP data segment rows. Region information supports full customization. You can append data for specific business needs to the region, such as: GPS information/International Standard Regional Codes/Zip codes, etc. - Data Deduplication and Compression: The xdb format generation program automatically processes the input raw data, checks and completes the merging of adjacent IP segments, and performs deduplication and compression of identical regional information. - High-Speed Query Response: Even for queries based entirely on the xdb file, the single query response time is at the 10-microsecond level. - vIndex Index Caching: Uses a fixed 512KiB of memory to cache vector index data, reducing one disk IO operation and maintaining average query efficiency within 100 microseconds. - Entire xdb File Caching: Loads the entire xdb file into memory. Memory usage is equal to the xdb file size. There is no disk IO operation, maintaining 10-microsecond level query efficiency. - Unified Query Interface: xdb provides version-compatible query implementations. A unified API can simultaneously provide queries for both IPv4 and IPv6 data and return unified data. >For API introductions, usage documentation, and test programs, please refer to the README introduction under the corresponding searcher query client. Repository lionsoul2014/ip2region Repository stats |Metric|Value| |:-|:-| |Stars|19,705| |Forks|3,078| |Last release|v3.18.0 (2026-09-08)| |Languages|Go 18.9%, Java 18.6%, C 12.3%| |Contributors|48| |AI contributor accounts (Claude / Codex / Cursor / Copilot)|None| |AI co-authored commits|None| Main contributor |Field|Value| |:-|:-| |Name|Leon| |GitHub|@lionsoul2014| |Commits to this repo|742 (top contributor)| |Bio|A creative being.| |Company / Location|Shenzhen, China| |Followers|615| |Public repos|14| |On GitHub since|2014-03-31| ────────────────────────────── 📌 How many great GitHub repos have you discovered and completely forgotten about? Don't let another useful tool disappear into your Reddit feed. Get the community's best repos, organized by category, plus key takeaways from real developer discussions, delivered to your inbox twice a week. 📬 Never lose track of great repos again. Subscribe free.