Compare commits

...

3 Commits

View File

@ -8,6 +8,7 @@ import (
"golang.org/x/text/transform"
"io/ioutil"
"net"
"strings"
"sync"
)
@ -138,8 +139,16 @@ func QueryIP(queryIp string) (city string, area string, err error) {
}
}
}
city = gb18030Decode([]byte(city))
area = gb18030Decode([]byte(area))
if city != "" {
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})
return
}