qqwry/client/client.go

26 lines
393 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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, isp, err := qqwry.QueryIP(queryIp)
if err != nil {
fmt.Printf("错误:%v\n", err)
return
}
fmt.Printf("城市:%s运营商%s\n", city, isp)
}