From 7df63939d2d5d99dc4f29365f0ae7a8356975abf Mon Sep 17 00:00:00 2001 From: naiba Date: Sat, 16 Jan 2021 14:51:33 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8F=8C=E6=A0=88IP=E5=8F=AA=E8=83=BD=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=88=B0v6=E7=9A=84=E9=97=AE=E9=A2=98=20close=20#61?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ service/monitor/monitor.go | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) 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,