fix: CountryCode 被冲掉
This commit is contained in:
parent
26d81f6d7a
commit
df9487b5fc
@ -138,7 +138,6 @@ func (s *NezhaHandler) ReportSystemInfo(c context.Context, r *pb.Host) (*pb.Rece
|
|||||||
singleton.ServerList[clientID].Host != nil &&
|
singleton.ServerList[clientID].Host != nil &&
|
||||||
host.IP != "" &&
|
host.IP != "" &&
|
||||||
singleton.ServerList[clientID].Host.IP != host.IP {
|
singleton.ServerList[clientID].Host.IP != host.IP {
|
||||||
|
|
||||||
serverDomain := singleton.ServerList[clientID].DDNSDomain
|
serverDomain := singleton.ServerList[clientID].DDNSDomain
|
||||||
if singleton.Conf.DDNS.Provider == "" {
|
if singleton.Conf.DDNS.Provider == "" {
|
||||||
provider, err = singleton.GetDDNSProviderFromProfile(singleton.ServerList[clientID].DDNSProfile)
|
provider, err = singleton.GetDDNSProviderFromProfile(singleton.ServerList[clientID].DDNSProfile)
|
||||||
@ -191,6 +190,11 @@ func (s *NezhaHandler) ReportSystemInfo(c context.Context, r *pb.Host) (*pb.Rece
|
|||||||
singleton.ServerList[clientID].PrevHourlyTransferOut = singleton.ServerList[clientID].PrevHourlyTransferOut - int64(singleton.ServerList[clientID].State.NetOutTransfer)
|
singleton.ServerList[clientID].PrevHourlyTransferOut = singleton.ServerList[clientID].PrevHourlyTransferOut - int64(singleton.ServerList[clientID].State.NetOutTransfer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 不要冲掉国家码
|
||||||
|
if singleton.ServerList[clientID].Host != nil {
|
||||||
|
host.CountryCode = singleton.ServerList[clientID].Host.CountryCode
|
||||||
|
}
|
||||||
|
|
||||||
singleton.ServerList[clientID].Host = &host
|
singleton.ServerList[clientID].Host = &host
|
||||||
return &pb.Receipt{Proced: true}, nil
|
return &pb.Receipt{Proced: true}, nil
|
||||||
}
|
}
|
||||||
@ -239,7 +243,9 @@ func (s *NezhaHandler) LookupGeoIP(c context.Context, r *pb.GeoIP) (*pb.GeoIP, e
|
|||||||
// 将地区码写入到 Host
|
// 将地区码写入到 Host
|
||||||
singleton.ServerLock.RLock()
|
singleton.ServerLock.RLock()
|
||||||
defer singleton.ServerLock.RUnlock()
|
defer singleton.ServerLock.RUnlock()
|
||||||
|
if singleton.ServerList[clientID].Host != nil {
|
||||||
singleton.ServerList[clientID].Host.CountryCode = location
|
singleton.ServerList[clientID].Host.CountryCode = location
|
||||||
|
}
|
||||||
|
|
||||||
return &pb.GeoIP{Ip: ip, CountryCode: location}, nil
|
return &pb.GeoIP{Ip: ip, CountryCode: location}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user