package ip import ( "net/http" "io/ioutil" "github.com/axgle/mahonia" "regexp" "strings" "net" "fmt" "HFish/utils/try" "HFish/utils/log" "github.com/ipipdotnet/ipdb-go" ) var ipipDB *ipdb.City func init() { ipipDB, _ = ipdb.NewCity("./db/ipip.ipdb") } // 爬虫 ip138 获取 ip 地理信息 // ~~~~~~ 暂时废弃,采用 IPIP func GetIp138(ip string) string { result := "" try.Try(func() { resp, _ := http.Get("http://ip138.com/ips138.asp?ip=" + ip) defer resp.Body.Close() input, _ := ioutil.ReadAll(resp.Body) out := mahonia.NewDecoder("gbk").ConvertString(string(input)) reg := regexp.MustCompile(`