- 删除了 CheckBelongPrivate.go 文件中的私有IP检测功能 - 升级 Go 版本从 1.20 到 1.23.0 并添加 toolchain 配置 - 更新项目依赖,移除旧的配置管理库,添加 Gin 框架和日志库 - 精简依赖列表,移除大量 unused 的间接依赖包 - 重新生成 go.sum 文件以匹配新的依赖关系
84 lines
1.3 KiB
Markdown
84 lines
1.3 KiB
Markdown
# CheckIP
|
||
|
||
## 相关命令
|
||
|
||
|
||
### 构建Linux二进制文件
|
||
|
||
```
|
||
GOOS=linux GOARCH=amd64 go build main.go
|
||
```
|
||
|
||
|
||
|
||
### docker配置反向代理
|
||
|
||
```shell
|
||
docker run --name nginx -p 8888:8888 -d nginx
|
||
```
|
||
|
||
### 数据库文件下载地址
|
||
|
||
```bash
|
||
https://www.maxmind.com/en/account/login
|
||
```
|
||
|
||
### 数据库使用
|
||
|
||
```
|
||
https://github.com/IncSW/geoip2
|
||
```
|
||
|
||
### 构建项目Windows二进制文件
|
||
|
||
```bash
|
||
GOOS=windows GOARCH=amd64 go build
|
||
```
|
||
|
||
### 数据库文件转换网址
|
||
|
||
```http
|
||
https://dev.maxmind.com/geoip/docs/databases/city-and-country
|
||
```
|
||
|
||
### 官方转换工具
|
||
|
||
转换工具地址
|
||
|
||
```bash
|
||
https://github.com/maxmind/geoip2-csv-converter
|
||
```
|
||
|
||
Windows转换命令
|
||
|
||
```bash
|
||
.\geoip2-csv-converter.exe -block-file GeoLite2-City-Blocks-IPv4.csv -include-range -output-file GeoLite2-City-Blocks-IPv4-string.csv
|
||
```
|
||
|
||
转换为16进制
|
||
|
||
```bash
|
||
.\geoip2-csv-converter.exe -block-file GeoLite2-City-Blocks-IPv4.csv -include-hex-range -output-file GeoLite2-City-Blocks-IPv4-hex.csv
|
||
```
|
||
|
||
Linux转换命令
|
||
|
||
```bash
|
||
./geoip2-csv-converter -block-file GeoLite2-City-Blocks-IPv4.csv -include-hex-range -output-file GeoIP2-City-Blocks-IPv4-Hex.csv
|
||
```
|
||
|
||
## 文件结构
|
||
|
||
db----------数据库文件
|
||
|
||
cmd---------主程序入口
|
||
|
||
web---------web静态资源
|
||
|
||
tests-------测试单元
|
||
|
||
## 注意
|
||
|
||
英文数据库较完善,中文数据库部分city字段没有值
|
||
|