Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orestonce/ip2region
go版本的ip2region https://github.com/lionsoul2014/ip2region
https://github.com/orestonce/ip2region
Last synced: 23 days ago
JSON representation
go版本的ip2region https://github.com/lionsoul2014/ip2region
- Host: GitHub
- URL: https://github.com/orestonce/ip2region
- Owner: orestonce
- License: mit
- Created: 2021-11-02T12:45:07.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-05T01:36:11.000Z (about 3 years ago)
- Last Synced: 2024-06-21T00:05:04.510Z (5 months ago)
- Language: Go
- Size: 1.36 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ip2region
go版本的ip2region https://github.com/lionsoul2014/ip2region## 库特点
1. 舍弃原始库的文件搜索模式,使用golang的embed特性将数据文件直接嵌入到go程序中,只提供内存搜索
2. 支持多线程同时查询
3. 使用string形式ip查询地区信息,查询速度约为 900纳秒一次(0.0009毫秒),单线程每秒可达百万qps,如果使用uint32查地区信息,性能还可提升一倍
````
$go test -test.bench .
goos: linux
goarch: amd64
pkg: github.com/orestonce/ip2region
cpu: Intel(R) Xeon(R) CPU E5-26xx v4
BenchmarkGetIpInfo-2 1233267 875.7 ns/op
BenchmarkGetIpInfoFromUint32-2 4014752 334.4 ns/op
````