fix: 双栈位置上报

This commit is contained in:
naiba 2024-07-28 22:22:47 +08:00
parent fa0cc9bb7a
commit 3989ee87c8

View File

@ -38,19 +38,17 @@ func UpdateIP(useIPv6CountryCode bool, period uint32) {
}
continue
}
if ipv4 == "" || ipv6 == "" {
if ipv4 == "" {
GeoQueryIP = ipv6
} else {
GeoQueryIP = ipv4
}
CachedIP = fmt.Sprintf("%s%s", ipv4, ipv6)
} else {
CachedIP = fmt.Sprintf("%s/%s", ipv4, ipv6)
}
if useIPv6CountryCode {
if ipv6 != "" && useIPv6CountryCode {
GeoQueryIP = ipv6
} else {
GeoQueryIP = ipv4
}
time.Sleep(time.Second * time.Duration(period))