mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-14 08:19:53 +00:00
fix: resolve_preference should only assign each ip once
This commit is contained in:
parent
1462cadfdc
commit
88099ee72d
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user