@@ -12,8 +12,8 @@ import (
12
12
"github.com/metacubex/mihomo/common/utils"
13
13
"github.com/metacubex/mihomo/component/trie"
14
14
15
+ "github.com/metacubex/randv2"
15
16
"github.com/miekg/dns"
16
- "github.com/zhangyunhao116/fastrand"
17
17
)
18
18
19
19
var (
@@ -93,7 +93,7 @@ func ResolveIPv4WithResolver(ctx context.Context, host string, r Resolver) (neti
93
93
} else if len (ips ) == 0 {
94
94
return netip.Addr {}, fmt .Errorf ("%w: %s" , ErrIPNotFound , host )
95
95
}
96
- return ips [fastrand . Intn (len (ips ))], nil
96
+ return ips [randv2 . IntN (len (ips ))], nil
97
97
}
98
98
99
99
// ResolveIPv4 with a host, return ipv4
@@ -149,7 +149,7 @@ func ResolveIPv6WithResolver(ctx context.Context, host string, r Resolver) (neti
149
149
} else if len (ips ) == 0 {
150
150
return netip.Addr {}, fmt .Errorf ("%w: %s" , ErrIPNotFound , host )
151
151
}
152
- return ips [fastrand . Intn (len (ips ))], nil
152
+ return ips [randv2 . IntN (len (ips ))], nil
153
153
}
154
154
155
155
func ResolveIPv6 (ctx context.Context , host string ) (netip.Addr , error ) {
@@ -200,9 +200,9 @@ func ResolveIPWithResolver(ctx context.Context, host string, r Resolver) (netip.
200
200
}
201
201
ipv4s , ipv6s := SortationAddr (ips )
202
202
if len (ipv4s ) > 0 {
203
- return ipv4s [fastrand . Intn (len (ipv4s ))], nil
203
+ return ipv4s [randv2 . IntN (len (ipv4s ))], nil
204
204
}
205
- return ipv6s [fastrand . Intn (len (ipv6s ))], nil
205
+ return ipv6s [randv2 . IntN (len (ipv6s ))], nil
206
206
}
207
207
208
208
// ResolveIP with a host, return ip and priority return TypeA
0 commit comments