fix: agent ipv6 info

This commit is contained in:
naiba committed 2021-03-20 10:14:15 +08:00
1 parent 75210d87ca
commit 4cfc968cb6
1 file changed
+4 -3
+4 -3
View File
@@ -65,10 +65,11 @@ func GetHost() *model.Host {
if err == nil {
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
if ip.IP == "" {
cachedIP = string(body)
json.Unmarshal(body, &ip)
if cachedIP == "" {
cachedIP = ip.IP
} else {
cachedIP = fmt.Sprintf("ip(v4: %s, v6: %s)", ip.IP, body)
cachedIP = fmt.Sprintf("ip(v4: %s, v6: %s)", cachedIP, ip.IP)
}
country = ip.CountryCode
}