mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-09-21 15:36:04 +00:00
fix: resolve_preference should only assign each ip once
This commit is contained in:
@@ -39,9 +39,9 @@ func resolveIPAddrWithPreference(host string, pref ResolvePreference) (*net.IPAd
|
|||||||
var ip4, ip6 *net.IPAddr
|
var ip4, ip6 *net.IPAddr
|
||||||
for i := range ips {
|
for i := range ips {
|
||||||
ip := &ips[i]
|
ip := &ips[i]
|
||||||
if ip.IP.To4() != nil {
|
if ip4 == nil && ip.IP.To4() != nil {
|
||||||
ip4 = ip
|
ip4 = ip
|
||||||
} else {
|
} else if ip6 == nil && ip.IP.To4() == nil {
|
||||||
ip6 = ip
|
ip6 = ip
|
||||||
}
|
}
|
||||||
if ip4 != nil && ip6 != nil {
|
if ip4 != nil && ip6 != nil {
|
||||||
|
Reference in New Issue
Block a user