fix: cycle wrapped IP information
This commit is contained in:
parent
65eba098f1
commit
db67565d97
@ -20,11 +20,11 @@ import (
|
|||||||
"github.com/p14yground/go-github-selfupdate/selfupdate"
|
"github.com/p14yground/go-github-selfupdate/selfupdate"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
|
"github.com/naiba/nezha/cmd/agent/monitor"
|
||||||
"github.com/naiba/nezha/model"
|
"github.com/naiba/nezha/model"
|
||||||
"github.com/naiba/nezha/pkg/utils"
|
"github.com/naiba/nezha/pkg/utils"
|
||||||
pb "github.com/naiba/nezha/proto"
|
pb "github.com/naiba/nezha/proto"
|
||||||
"github.com/naiba/nezha/service/dao"
|
"github.com/naiba/nezha/service/dao"
|
||||||
"github.com/naiba/nezha/service/monitor"
|
|
||||||
"github.com/naiba/nezha/service/rpc"
|
"github.com/naiba/nezha/service/rpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ type ipDotSbGeoIP struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var netInSpeed, netOutSpeed, netInTransfer, netOutTransfer, lastUpdate uint64
|
var netInSpeed, netOutSpeed, netInTransfer, netOutTransfer, lastUpdate uint64
|
||||||
|
|
||||||
var cachedIP, country string
|
var cachedIP, country string
|
||||||
var latestFetchIP time.Time
|
var latestFetchIP time.Time
|
||||||
|
|
||||||
@ -60,6 +59,8 @@ func GetHost() *model.Host {
|
|||||||
json.Unmarshal(body, &ip)
|
json.Unmarshal(body, &ip)
|
||||||
cachedIP = ip.IP
|
cachedIP = ip.IP
|
||||||
country = ip.CountryCode
|
country = ip.CountryCode
|
||||||
|
} else {
|
||||||
|
cachedIP = ""
|
||||||
}
|
}
|
||||||
resp, err = http.Get("https://api-ipv6.ip.sb/geoip")
|
resp, err = http.Get("https://api-ipv6.ip.sb/geoip")
|
||||||
if err == nil {
|
if err == nil {
|
Loading…
x
Reference in New Issue
Block a user