qqwry/README.md

55 lines
1.5 KiB
Markdown
Raw Normal View History

2021-01-21 14:32:57 +08:00
# QQWry [![Go Reference](https://pkg.go.dev/badge/github.com/xiaoqidun/qqwry.svg)](https://pkg.go.dev/github.com/xiaoqidun/qqwry)
2021-01-21 11:54:01 +08:00
2021-01-21 18:25:47 +08:00
Golang QQWry高性能纯真IP查询库。
2021-01-21 11:19:15 +08:00
2021-01-21 18:14:38 +08:00
# 使用须知
2021-01-21 18:11:07 +08:00
2021-01-21 18:14:38 +08:00
1. 仅支持ipv4查询。
2. city可能是城市也可能是国家。
3. area可能是区域也可能是运营商。
2021-01-21 18:11:07 +08:00
2021-01-21 11:54:01 +08:00
# 使用说明
```go
package main
import (
"github.com/xiaoqidun/qqwry"
"log"
)
func main() {
// 从文件加载IP数据库
if err := qqwry.LoadFile("qqwry.dat"); err != nil {
panic(err)
}
// 从内存或缓存查询IP
2021-01-21 18:08:31 +08:00
city, area, err := qqwry.QueryIP("1.1.1.1")
log.Printf("城市:%s区域%s错误%v", city, area, err)
2021-01-21 11:54:01 +08:00
}
```
2021-01-23 11:41:14 +08:00
# IP数据库
- [https://aite.xyz/share-file/qqwry/qqwry.dat](https://aite.xyz/share-file/qqwry/qqwry.dat)
# 编译说明
1. 下载IP数据库并放置于assets目录中。
2. client和server需要go1.16的内嵌资源特性。
3. 作为库使用请直接引包并不需要go1.16+才能编译。
# 服务接口
1. 自行根据需要调整server下源码。
2. 可以通过-listen参数指定http服务地址。
2021-01-23 15:29:26 +08:00
3. json apicurl http://127.0.0.1/ip/1.1.1.1
2021-01-21 11:19:15 +08:00
# 特别感谢
2021-01-21 11:54:01 +08:00
2021-01-21 12:02:07 +08:00
- 感谢[纯真IP库](https://www.cz88.net/)一直坚持为大家提供免费IP数据库。
- 感谢[yinheli](https://github.com/yinheli)的[qqwry](https://github.com/yinheli/qqwry)项目为我提供纯真ip库解析算法参考。
2021-01-21 11:19:15 +08:00
# 授权说明
2021-01-21 11:54:01 +08:00
2021-01-21 11:19:15 +08:00
使用本类库你唯一需要做的就是把LICENSE文件往你用到的项目中拷贝一份。