diff --git a/README.md b/README.md index 155c212..598ebbf 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,10 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。 ## 变更日志 +- `agent 0.2.2` + + - 修复双栈IP只能获取到v6的问题 #61 + - `dashboard 0.2.1` `agent 0.2.1` - dashboard diff --git a/service/monitor/monitor.go b/service/monitor/monitor.go index 7c9e845..16ad4d0 100644 --- a/service/monitor/monitor.go +++ b/service/monitor/monitor.go @@ -37,20 +37,18 @@ func GetHost() *model.Host { ms, _ := mem.SwapMemory() u, _ := disk.Usage("/") var ip ipDotSbGeoIP - resp, err := http.Get("https://api.ip.sb/geoip") + resp, err := http.Get("https://api-ipv4.ip.sb/geoip") if err == nil { defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) json.Unmarshal(body, &ip) } - resp, err = http.Get("https://api-ipv6.ip.sb/ip") if err == nil { defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) ip.IP = fmt.Sprintf("ip(v4: %s, v6: %s)", ip.IP, body) } - return &model.Host{ Platform: hi.OS, PlatformVersion: hi.PlatformVersion,