Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ipsPublic

IP geolocation databases tool and library. IP 地理位置数据库工具。

License

NotificationsYou must be signed in to change notification settings

sjzar/ips

Repository files navigation

Go Report CardGoDocGitHub releaseGitHub license

ips 是一个命令行工具与库,可以轻松完成 IP 地理位置数据库的查询、转存与打包。

中文 |English

下载与安装

源码安装

go install github.com/sjzar/ips@latest

二进制安装

WindowsUnixMacOS

GitHub Releases 下载最新版本的二进制文件。

Homebrew 安装

brew tap sjzar/tapbrew install ips

特性

  • 一键查询、转存和打包 IP 地理位置数据库
  • 兼容多种数据库格式
  • 通过命令行参数或管道进行查询
  • 输出支持文本和 JSON 格式
  • 可自定义查询字段并持久化配置
  • 灵活的数据库字段改写:按需增减字段和内容修改

数据库支持列表

数据库查询转存打包官方网站说明
txt-本项目转存时使用
ipdbLink
mmdbLink
awdb-Link
qqwry-LinkIPv4 only
czdb-Link
zxinc-LinkIPv6 only
ip2region-LinkIPv4 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 许可下的开源软件。

致谢

About

IP geolocation databases tool and library. IP 地理位置数据库工具。

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp