- Notifications
You must be signed in to change notification settings - Fork35
IP geolocation databases tool and library. IP 地理位置数据库工具。
License
NotificationsYou must be signed in to change notification settings
sjzar/ips
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
ips 是一个命令行工具与库,可以轻松完成 IP 地理位置数据库的查询、转存与打包。
中文 |English
go install github.com/sjzar/ips@latest
从GitHub Releases 下载最新版本的二进制文件。
brew tap sjzar/tapbrew install ips
- 一键查询、转存和打包 IP 地理位置数据库
- 兼容多种数据库格式
- 通过命令行参数或管道进行查询
- 输出支持文本和 JSON 格式
- 可自定义查询字段并持久化配置
- 灵活的数据库字段改写:按需增减字段和内容修改
| 数据库 | 查询 | 转存 | 打包 | 官方网站 | 说明 |
|---|---|---|---|---|---|
| txt | ✅ | ✅ | ✅ | - | 本项目转存时使用 |
| ipdb | ✅ | ✅ | ✅ | Link | |
| mmdb | ✅ | ✅ | ✅ | Link | |
| awdb | ✅ | ✅ | - | Link | |
| qqwry | ✅ | ✅ | - | Link | IPv4 only |
| czdb | ✅ | ✅ | - | Link | |
| zxinc | ✅ | ✅ | - | Link | IPv6 only |
| ip2region | ✅ | ✅ | - | Link | IPv4 only |
更详细的使用说明请翻阅usage.md 。
# 基础查询ips<ip或文本> [选项]# 查询 IPips 61.144.235.160# 输出:61.144.235.160 [中国 广东 深圳 电信]# 使用管道查询 IPecho"61.144.235.160"| ips# 输出:61.144.235.160 [中国 广东 深圳 电信]# 使用指定的数据库文件查询 IPips -d ./GeoLite2-City.mmdb 61.144.235.160# 输出:61.144.235.160 [中国 广州]# 使用指定的数据库文件并设置查询字段ips -d ./GeoLite2-City.mmdb --fields country 61.144.235.160# 输出:61.144.235.160 [中国]# 使用指定的数据库文件,以 JSON 格式输出结果ips -d ./GeoLite2-City.mmdb --fields'*' -j 61.144.235.160# 输出:{"ip":"61.144.235.160","net":"61.144.192.0/18","data":{"city":"广州市","continent":"亚洲","country":"中国","latitude":"23.1181","longitude":"113.2539","utcOffset":"Asia/Shanghai"}}
# 基础转存命令,输出转存内容ips dump -i ./qqwry.dat# 输出:# # Dump Time: 2023-10-20 00:00:00# # Fields: country,area# ... <省略部分输出> ...# 指定字段进行转存ips dump -i ./qqwry.dat -f country# 输出:# # Dump Time: 2023-10-20 00:00:00# # Fields: country# ... <省略部分输出> ...# 转存内容并保存到文件ips dump -i ./qqwry.dat -o 1.txt
# 使用转存文件进行打包ips pack -i qqwry.txt -o qqwry.ipdb# 使用数据库文件进行打包ips pack -i qqwry.dat -o qqwry.ipdb# 使用数据库文件并指定字段进行打包ips pack -i qqwry.dat -f country -o country.ipdb
ips 是在 Apache-2.0 许可下的开源软件。
- IPIP.net 的 ipdb 数据库格式
- MaxMind 的 mmdb 数据库格式
- 埃文科技 的 awdb 数据库格式
- 纯真网络 的 qqwry 和 czdb 数据库格式
- ip.zxinc.org 的 zxinc 数据库格式
- @lionsoul2014 的ip2region 数据库格式
- @zu1k 的nali 项目,本项目查询功能参考了 nali 的方案
- @metowolf 的qqwry.dat 和 ipdb 项目
- GeoNames.org 的地理信息数据
- 各个 Go 开源库的贡献者们,例如cobra、viper、logrus、progressbar 等
About
IP geolocation databases tool and library. IP 地理位置数据库工具。
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.