mirror of
https://github.com/xiaoqidun/qqwry.git
synced 2026-09-10 13:30:05 +08:00
feat(适配特性): 适配纯真IP库社区版更新(2024-06-19)地理位置格式
This commit is contained in:
1 parent
26b587798e
commit
25daf60573
5 files changed
+98
-45
No files matched your search
+15
-3
@@ -11,10 +11,22 @@ func init() {
|
||||
}
|
||||
|
||||
func TestQueryIP(t *testing.T) {
|
||||
queryIp := "1.1.1.1"
|
||||
city, isp, err := QueryIP(queryIp)
|
||||
queryIp := "119.29.29.29"
|
||||
location, err := QueryIP(queryIp)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("城市:%s,运营商:%s", city, isp)
|
||||
emptyVal := func(val string) string {
|
||||
if val != "" {
|
||||
return val
|
||||
}
|
||||
return "未知"
|
||||
}
|
||||
t.Logf("国家:%s,省份:%s,城市:%s,区县:%s,运营商:%s",
|
||||
emptyVal(location.Country),
|
||||
emptyVal(location.Province),
|
||||
emptyVal(location.City),
|
||||
emptyVal(location.District),
|
||||
emptyVal(location.ISP),
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user