[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-3963":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":40,"readmeContent":41,"aiSummary":42,"trendingCount":16,"starSnapshotCount":16,"syncStatus":43,"lastSyncTime":44,"discoverSource":45},3963,"ip2region","lionsoul2014\u002Fip2region","lionsoul2014","Ip2region is an offline IP-to-Region localization library and IP data management framework with both IPv4 and IPv6 supports, 10-microsecond level query efficiency, xdb search client for many programming languages","https:\u002F\u002Fip2region.net",null,"Java",19139,3005,435,4,0,7,34,139,45,"Apache License 2.0",false,"master",true,[26,27,28,29,30,31,32,33,34,35,36,37,38,39],"ip-address","ip-address-database","ip-address-location","ip-location","ip-lookup","ipv4-address","ipv4-lookup","ipv4-support","ipv6-address","ipv6-lookup","ipv6-support","xdb-engine","xdb-ipv4","xdb-ipv6","2026-06-12 02:00:56",":globe_with_meridians: [中文简体](README_zh.md) | [English](README.md)\n\n# ip2region\n\n[ip2region](https:\u002F\u002Fip2region.net) - 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.\n\n\n# Features\n\n### 1. Offline Localization Library\n\nThe project itself provides raw data for both IPv4 (`data\u002Fipv4_source.txt`) and IPv6 (`data\u002Fipv6_source.txt`), along with corresponding xdb files (`data\u002Fip2region_v4.xdb` and `data\u002Fip2region_v6.xdb`) to achieve city-level query localization. The field format is: `Country|Province|City|ISP|iso-alpha2-code`. Localization information for China is entirely in Chinese, while regional information for non-China areas is entirely in English.\n\n### 2. Data Management Framework\n\n`xdb` supports hundreds of millions of IP data segment rows. Region information supports full customization. The region information of the built-in data is fixed in the format: `Country|Province|City|ISP|iso-alpha2-Code`. You can append data for specific business needs to the region, such as: GPS information\u002FInternational Standard Regional Codes\u002FZip codes, etc. In other words, you can fully use ip2region to manage your own IP localization data.\n\n### 3. Data Deduplication and Compression\n\nThe `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.\n\n### 4. High-Speed Query Response\n\nEven for queries based entirely on the `xdb` file, the single query response time is at the 10-microsecond level. Memory-accelerated queries can be enabled through the following two methods:\n\n1. `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.\n2. 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.\n\n### 5. Unified Query Interface\n\n`xdb` provides version-compatible query implementations. A unified API can simultaneously provide queries for both IPv4 and IPv6 data and return unified data.\n\n\n# `xdb` Query\n\nFor API introductions, usage documentation, and test programs, please refer to the README introduction under the corresponding `searcher` query client. All query binding implementations are as follows:\n\n| Language | Description | IPv4 Support | IPv6 Support |\n| --- | --- | --- | --- |\n| [Golang](binding\u002Fgolang\u002FREADME.md)         | golang query client          | :white_check_mark: | :white_check_mark: |\n| [PHP](binding\u002Fphp\u002FREADME.md)               | php query client             | :white_check_mark: | :white_check_mark: |\n| [Java](binding\u002Fjava\u002FREADME.md)             | java query client            | :white_check_mark: | :white_check_mark: |\n| [C](binding\u002Fc\u002FREADME.md)                   | C[std=c99] query client      | :white_check_mark: | :white_check_mark: |\n| [Lua_c](binding\u002Flua_c\u002FREADME.md)           | lua c extension query client | :white_check_mark: | :white_check_mark: |\n| [Lua](binding\u002Flua\u002FREADME.md)               | lua query client             | :white_check_mark: | :white_check_mark: |\n| [Rust](binding\u002Frust\u002FREADME.md)             | rust query client            | :white_check_mark: | :white_check_mark: |\n| [Python](binding\u002Fpython\u002FREADME.md)         | python query client          | :white_check_mark: | :white_check_mark: |\n| [Javascript](binding\u002Fjavascript\u002FREADME.md) | javascript query client      | :white_check_mark: | :white_check_mark: |\n| [Csharp](binding\u002Fcsharp)                   | csharp query client          | :white_check_mark: | :white_check_mark: |\n| [Erlang](binding\u002Ferlang\u002FREADME.md)         | erlang query client          | :white_check_mark: | :x:                |\n| [Nginx](binding\u002Fnginx)                     | nginx extension query client | :white_check_mark: | :white_check_mark: |\n| [C++](binding\u002Fcpp\u002FREADME.md)               | C++ query client             | :white_check_mark: | :white_check_mark: |\n| [Cangjie](binding\u002Fcangjie\u002FREADME.md)       | Cangjie query client         | :white_check_mark: | :white_check_mark: |\n\nThe following toolchain implementations are contributed by community developers via third-party repositories:\n\n| Language | Description |\n| --- | --- |\n| [ip2region-composer](https:\u002F\u002Fgithub.com\u002Fzoujingli\u002Fip2region)    | php composer management client       |\n| [ip2region-ts](https:\u002F\u002Fgithub.com\u002FSteven-Qiang\u002Fts-ip2region2)   | node.js addon management client      |\n| [ruby-ip2region](https:\u002F\u002Fgithub.com\u002Fjicheng1014\u002Fruby-ip2region) | ruby xdb query client implementation |\n| [Ip2regionTool](https:\u002F\u002Fgithub.com\u002Forestonce\u002FIp2regionTool)     | ip2region data conversion tool       |\n\n\n# `xdb` Generation\n\nFor API introductions, usage documentation, and test programs, please refer to the README documents under the following `maker` generation programs:\n\n| Language | Description | IPv4 Support | IPv6 Support |\n| --- | --- | --- | --- |\n| [Golang](maker\u002Fgolang\u002FREADME.md) | golang xdb generation program | :white_check_mark: | :white_check_mark: |\n| [Java](maker\u002Fjava\u002FREADME.md)     | java xdb generation program   | :white_check_mark: | :white_check_mark: |\n| [Python](maker\u002Fpython\u002FREADME.md) | python xdb generation program | :white_check_mark: | :x:                |\n| [Csharp](maker\u002Fcsharp\u002FREADME.md) | csharp xdb generation program | :white_check_mark: | :x:                |\n| [Rust](maker\u002Frust\u002FREADME.md)     | rust xdb generation program   | :white_check_mark: | :white_check_mark: |\n| [C++](maker\u002Fcpp)                 | C++ xdb generation program    | :white_check_mark: | :white_check_mark: |\n\n\n# `xdb` Update\n\nThe core of the ip2region project lies in **researching the design and implementation of IP data storage and fast querying**. The raw data `.\u002Fdata\u002Fipv4_source.txt` and `.\u002Fdata\u002Fipv6_source.txt` included in the project are updated irregularly. For scenarios with high requirements for data accuracy and update frequency, it is recommended to purchase commercial offline data from the [Ip2Region Community](https:\u002F\u002Fip2region.net\u002Fproducts\u002Foffline) or third-party vendors. You can try to update the data yourself using the following methods:\n\n### Manual Editing and Updating\n\nYou can modify the data yourself based on the raw IP data provided by ip2region in `.\u002Fdata\u002Fipv4_source.txt` and `.\u002Fdata\u002Fipv6_source.txt` using the editing tools provided by ip2region. Currently, the data sources include:\n\n1. Data provided by the ip2region community (please refer to the official account at the bottom for community notifications)\n2. Project Issues tagged with `[Data_Updates]`\n3. Other custom data: e.g., data provided by customers, data obtained through GPS and WIFI positioning, or legal and compliant data from other platforms.\n\nFor instructions on using the raw IP data editing tools, please refer to the README documents under the following `maker` generation programs:\n\n| Language | Description | IPv4 Support | IPv6 Support |\n| --- | --- | --- | --- |\n| [Golang](maker\u002Fgolang\u002FREADME.md#xdb-data-editing) | golang IP raw data editor | :white_check_mark: | :white_check_mark: |\n| [C++](maker\u002Fcpp\u002FREADME.md)                        | C++ IP raw data editor    | :white_check_mark: | :white_check_mark: |\n\n### Detection Automatic Update\n\nIf you want to update data via your own API or data source, you can refer to the update algorithm based on the \"Detection Algorithm\" shared in the following videos to write your own update program:\n\n1. [Data Update Implementation Video Sharing - part1](https:\u002F\u002Fwww.bilibili.com\u002Fvideo\u002FBV1934y1E7Q5\u002F)\n2. [Data Update Implementation Video Sharing - part2](https:\u002F\u002Fwww.bilibili.com\u002Fvideo\u002FBV1pF411j7Aw\u002F)\n\n\n# Official Community\n\nThe Ip2Region official community was officially launched on `2025\u002F06\u002F12`. On one hand, it provides stable [commercial offline data](https:\u002F\u002Fip2region.net\u002Fproducts\u002Foffline) services. On the other hand, it facilitates the strengthening of the IP toolchain and data services outside the core code, such as [usage documentation](https:\u002F\u002Fip2region.net\u002Fdoc\u002F), [query testing](https:\u002F\u002Fip2region.net\u002Fsearch\u002Fdemo), and data correction. For more information and services regarding the community, please visit the [Ip2Region Official Community](https:\u002F\u002Fip2region.net\u002F).\n\n\n# Related Remarks\n\n### 1. xdb Technical Documents:\n\n1. xdb Data Structure Analysis: [\"ip2region xdb - Data Structure Description\"](https:\u002F\u002Fip2region.net\u002Fdoc\u002Fxdb\u002Fstructure)\n2. xdb Query Process Analysis: [\"ip2region xdb - Query Process Description\"](https:\u002F\u002Fip2region.net\u002Fdoc\u002Fxdb\u002Fsearch)\n3. xdb Generation Process Analysis: [\"ip2region xdb - Generation Process Description\"](https:\u002F\u002Fip2region.net\u002Fdoc\u002Fxdb\u002Fgenerate)\n4. xdb File Generation Tutorial: [\"ip2region xdb - File Generation Tutorial\"](https:\u002F\u002Fip2region.net\u002Fdoc\u002Fdata\u002Fxdb_make)\n5. xdb Concurrent Safety Query: [\"ip2region xdb - Concurrent Safety Query\"](https:\u002F\u002Fip2region.net\u002Fdoc\u002Fxdb\u002Fconcurrent)\n6. xdb Data Update Method: [\"ip2region Data Update and Use of xdb Data Editor\"](https:\u002F\u002Fmp.weixin.qq.com\u002Fs\u002FcZH5qIn4E5rQFy6N32RCzA)\n\n### 3. Technical Information Blogs\n\n1. WeChat Official Account - lionsoul-org, the author's active technical sharing channel\n2. [Ip2Region Official Community](https:\u002F\u002Fip2region.net)\n","ip2region是一个支持IPv4和IPv6的离线IP地址定位库及数据管理框架，具有10微秒级别的查询效率。该项目提供了多种编程语言的xdb搜索客户端实现，支持海量IP数据段行的管理和自定义区域信息，并且能够自动处理输入的原始数据，进行相邻IP段的合并以及重复区域信息的压缩。其高效率的查询响应机制包括基于内存加速的vIndex索引缓存和全文件缓存两种方式，确保了无论是基于磁盘还是内存的查询都能保持在极低的延迟水平内。ip2region适用于需要快速准确地将IP地址转换为地理位置信息的各种应用场景，如网络安全、广告定向投放等。",2,"2026-06-11 02:57:29","top_language"]