fix: cycle wrapped IP information

This commit is contained in:
naiba 2021-03-20 14:53:10 +08:00
parent 65eba098f1
commit db67565d97
2 changed files with 3 additions and 2 deletions

View File

@ -20,11 +20,11 @@ import (
"github.com/p14yground/go-github-selfupdate/selfupdate"
"google.golang.org/grpc"
"github.com/naiba/nezha/cmd/agent/monitor"
"github.com/naiba/nezha/model"
"github.com/naiba/nezha/pkg/utils"
pb "github.com/naiba/nezha/proto"
"github.com/naiba/nezha/service/dao"
"github.com/naiba/nezha/service/monitor"
"github.com/naiba/nezha/service/rpc"
)

View File

@ -25,7 +25,6 @@ type ipDotSbGeoIP struct {
}
var netInSpeed, netOutSpeed, netInTransfer, netOutTransfer, lastUpdate uint64
var cachedIP, country string
var latestFetchIP time.Time
@ -60,6 +59,8 @@ func GetHost() *model.Host {
json.Unmarshal(body, &ip)
cachedIP = ip.IP
country = ip.CountryCode
} else {
cachedIP = ""
}
resp, err = http.Get("https://api-ipv6.ip.sb/geoip")
if err == nil {