Compare commits

...

3 Commits

View File

@ -8,6 +8,7 @@ import (
"golang.org/x/text/transform" "golang.org/x/text/transform"
"io/ioutil" "io/ioutil"
"net" "net"
"strings"
"sync" "sync"
) )
@ -138,8 +139,16 @@ func QueryIP(queryIp string) (city string, area string, err error) {
} }
} }
} }
city = gb18030Decode([]byte(city)) if city != "" {
area = gb18030Decode([]byte(area)) city = strings.TrimSpace(gb18030Decode([]byte(city)))
}
if area != "" {
if strings.Contains(area, "CZ88.NET") {
area = ""
} else {
area = strings.TrimSpace(gb18030Decode([]byte(area)))
}
}
ipCache.Store(queryIp, cache{City: city, Area: area}) ipCache.Store(queryIp, cache{City: city, Area: area})
return return
} }