mirror of
https://github.com/xiaoqidun/qqwry.git
synced 2023-06-27 14:38:22 +08:00
feat(添加功能): client作为本地查询工具,server作为服务给其他服务调用
This commit is contained in:
25
client/client.go
Normal file
25
client/client.go
Normal file
@ -0,0 +1,25 @@
|
||||
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]
|
||||
city, area, err := qqwry.QueryIP(queryIp)
|
||||
if err != nil {
|
||||
fmt.Printf("错误:%v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("城市:%s,区域:%s\n", city, area)
|
||||
}
|
Reference in New Issue
Block a user