feat(适配特性): 适配纯真IP库社区版更新(2024-06-19)地理位置格式

This commit is contained in:
2024-06-20 00:38:19 +08:00
parent 26b587798e
commit 25daf60573
5 changed files with 98 additions and 45 deletions

View File

@@ -16,10 +16,22 @@ func main() {
return
}
queryIp := os.Args[1]
city, isp, err := qqwry.QueryIP(queryIp)
location, err := qqwry.QueryIP(queryIp)
if err != nil {
fmt.Printf("错误:%v\n", err)
return
}
fmt.Printf("城市:%s运营商%s\n", city, isp)
emptyVal := func(val string) string {
if val != "" {
return val
}
return "未知"
}
fmt.Printf("国家:%s省份%s城市%s区县%s运营商%s\n",
emptyVal(location.Country),
emptyVal(location.Province),
emptyVal(location.City),
emptyVal(location.District),
emptyVal(location.ISP),
)
}