[分享创造] [开源] ip2geo:零依赖的 Go IP 归属地查询库, IPv4 查询比 geoip2-golang 快 14~ 58 倍
GitHub: https://github.com/haxqer/ip2geo 写这个库的起因很简单:服务里用 geoip2-golang 查 IP 归属地,profile 一看,单次 City() 要 1.7µs 左右,大部分时间花在解码 mmdb 的数据结构上。而我其实只需要国家 / 省份 / 城市 / 经纬度 / 时区这几个字段。 于是做了 ip2geo:把 MaxMind GeoIP2 / GeoLite2 City (或 DB-IP )的 .mmdb 一次性转成紧凑的 .geoc 文件,之后直接在它上面查 IPv4 / IPv6 。 性能 Apple M3 单核,500 万个随机 IPv4 ,5 次取中位数: reader ns / 次 吞吐 相对 City() geoip2-golang City() 1768 0.6 M/s 1× geoip2-golang Country() 1121 0.9 M/s 1.6× ip2geo city profile 119 8.4 M/s 14.5× ip2geo country profile 30.5 32.8 M/s 58×
Read original sourceSource record
Research analysis
Project record
Source account: GitHub: https://github.com/haxqer/ip2geo 写这个库的起因很简单:服务里用 geoip2-golang 查 IP 归属地,profile 一看,单次 City() 要 1.7µs 左右,大部分时间花在解码 mmdb 的数据结构上。而我其实只需要国家 / 省份 / 城市 / 经纬度 / 时区这几个字段。 于是做了 ip2geo:把 MaxMind GeoIP2 / GeoLite2 City (或 DB-IP )的 .mmdb 一次性转成紧凑的 .geoc 文件,之后直接在它上面查 IPv4 / IPv6 。 性能 Apple M3 单核,500 万个随机 IPv4 ,5 次取中位数: reader ns / 次 吞吐 相对 City() geoip2-golang City() 1768 0.6 M/s 1× geoip2-golang Country() 1121 0.9 M/s 1.6× ip2geo city profile 119 8.4 M/s 14.5× ip2geo country profile 30.5 32.8 M/s 58×
Observed adoption & comparisons
Recent records to compare: “astral-sh/ruff” (GitHub Trending, Nov 6, 2026); “microsoft/vscode” (GitHub Trending, Nov 6, 2026). Shared themes are navigation hints; they have not been verified as the same need or independent corroboration.
Adoption decision
Evaluate it against the tool or manual workflow it would replace. The stored record supports discovery; it does not yet establish reliability, lower operating cost or commercial adoption.
Unverified requirements
Not verified: license permissions, required hardware, installation steps, maintenance status and a representative task with its failure cases.
Next test
Choose one real task and a current alternative. Record the commit, environment, input, output, elapsed time and failure behavior; retain the result before recommending adoption.