2021-01-23 15:26:04 +08:00
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/xiaoqidun/qqwry"
|
|
|
|
|
"github.com/xiaoqidun/qqwry/assets"
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
qqwry.LoadData(assets.QQWryDat)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
if len(os.Args) < 2 {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
queryIp := os.Args[1]
|
2021-07-08 11:39:43 +08:00
|
|
|
|
city, isp, err := qqwry.QueryIP(queryIp)
|
2021-01-23 15:26:04 +08:00
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Printf("错误:%v\n", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
2021-07-08 11:39:43 +08:00
|
|
|
|
fmt.Printf("城市:%s,运营商:%s\n", city, isp)
|
2021-01-23 15:26:04 +08:00
|
|
|
|
}
|