mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
🚸 improve: 优化agent取双栈IP、服务状态页面展示策略
This commit is contained in:
@@ -26,7 +26,7 @@ var SortedServerList []*model.Server
|
||||
|
||||
var ServerLock sync.RWMutex
|
||||
|
||||
var Version = "v0.2.0"
|
||||
var Version = "v0.2.1"
|
||||
|
||||
func ReSortServer() {
|
||||
SortedServerList = []*model.Server{}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -87,7 +87,8 @@ func (s *NezhaHandler) ReportSystemInfo(c context.Context, r *pb.Host) (*pb.Rece
|
||||
host := model.PB2Host(r)
|
||||
dao.ServerLock.RLock()
|
||||
defer dao.ServerLock.RUnlock()
|
||||
if dao.ServerList[clientID].Host != nil &&
|
||||
if dao.Conf.EnableIPChangeNotification &&
|
||||
dao.ServerList[clientID].Host != nil &&
|
||||
dao.ServerList[clientID].Host.IP != "" &&
|
||||
host.IP != "" &&
|
||||
dao.ServerList[clientID].Host.IP != host.IP {
|
||||
|
||||
Reference in New Issue
Block a user