🚸 improve: 优化agent取双栈IP、服务状态页面展示策略

This commit is contained in:
naiba
2021-01-16 11:23:42 +08:00
parent a41c792577
commit 345511e90f
7 changed files with 75 additions and 17 deletions

View File

@@ -43,6 +43,14 @@ func GetHost() *model.Host {
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,