From ae7eed8de6873bf06e68e495acd66171b46c0b7b Mon Sep 17 00:00:00 2001 From: zu1k Date: Sat, 18 Jul 2020 09:59:48 +0800 Subject: [PATCH] add ipv6 support --- README.md | 3 +++ pkg/zxipv6wry/zxipv6wry.go | 11 ++--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2ff84b0..d7e361a 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,12 @@ ## Feature - Chunzhen qqip database +- ZX ipv6 database - Geoip2 city database - Pipeline support - Interactive query - Offline query +- Both ipv4 and ipv6 support ## Install @@ -177,6 +179,7 @@ export NALI_DB=geoip - [纯真QQIP离线数据库](http://www.cz88.net/fox/ipdat.shtml) - [qqwry mirror](https://qqwry.mirror.noc.one/) - [qqwry纯真数据库解析](https://github.com/yinheli/qqwry) +- [ZX公网ipv6数据库](https://ip.zxinc.org/ipquery/) - [Geoip2 city数据库](https://www.maxmind.com/en/geoip2-precision-city-service) - [geoip2-golang解析器](https://github.com/oschwald/geoip2-golang) - [Cobra CLI库](https://github.com/spf13/cobra) diff --git a/pkg/zxipv6wry/zxipv6wry.go b/pkg/zxipv6wry/zxipv6wry.go index 9e25a4a..8b855c9 100644 --- a/pkg/zxipv6wry/zxipv6wry.go +++ b/pkg/zxipv6wry/zxipv6wry.go @@ -23,15 +23,8 @@ func NewZXwry(filePath string) ZXwry { // 判断文件是否存在 _, err := os.Stat(filePath) if err != nil && os.IsNotExist(err) { - log.Println("文件不存在,尝试从网络获取最新ZX IPv6 库") - tmpData, err = GetOnline() - if err != nil { - panic(err) - } else { - if err := ioutil.WriteFile(filePath, tmpData, 0644); err == nil { - log.Printf("已将最新的ZX IPv6 库保存到本地 %s ", filePath) - } - } + log.Println("文件不存在,请自行下载 ZX IPV6库,并保存在", filePath) + os.Exit(1) } else { // 打开文件句柄 fileInfo.FileBase, err = os.OpenFile(filePath, os.O_RDONLY, 0400)