diff --git a/cmd/agent/monitor/myip.go b/cmd/agent/monitor/myip.go index 17b09a4..a0a2449 100644 --- a/cmd/agent/monitor/myip.go +++ b/cmd/agent/monitor/myip.go @@ -65,6 +65,9 @@ func fetchGeoIP(servers []string, isV6 bool) geoIP { if err != nil { continue } + if ip.IP == "" && ip.Query != "" { + ip.IP = ip.Query + } // 没取到 v6 IP if isV6 && !strings.Contains(ip.IP, ":") { continue @@ -73,9 +76,6 @@ func fetchGeoIP(servers []string, isV6 bool) geoIP { if !isV6 && !strings.Contains(ip.IP, ".") { continue } - if ip.IP == "" && ip.Query != "" { - ip.IP = ip.Query - } return ip } }