mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
refactor: fallback agent ip to connecting ip
This commit is contained in:
@@ -201,9 +201,18 @@ func (s *NezhaHandler) ReportGeoIP(c context.Context, r *pb.GeoIP) (*pb.GeoIP, e
|
||||
}
|
||||
|
||||
geoip := model.PB2GeoIP(r)
|
||||
joinedIP := geoip.IP.Join()
|
||||
use6 := r.GetUse6()
|
||||
|
||||
if geoip.IP.IPv4Addr == "" && geoip.IP.IPv6Addr == "" {
|
||||
ip, _ := c.Value(model.CtxKeyRealIP{}).(string)
|
||||
if ip == "" {
|
||||
ip, _ = c.Value(model.CtxKeyConnectingIP{}).(string)
|
||||
}
|
||||
geoip.IP.IPv4Addr = ip
|
||||
}
|
||||
|
||||
joinedIP := geoip.IP.Join()
|
||||
|
||||
singleton.ServerLock.RLock()
|
||||
// 检查并更新DDNS
|
||||
if singleton.ServerList[clientID].EnableDDNS && joinedIP != "" &&
|
||||
|
||||
Reference in New Issue
Block a user