mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-17 06:55:13 +00:00
fix #1427
This commit is contained in:
2 files changed
+10
-7
No files matched your search
+3
-2
@@ -76,8 +76,9 @@ func NewStaticHosts(hosts []*Config_HostMapping, legacy map[string]*net.IPOrDoma
|
||||
func filterIP(ips []net.IP, option IPOption) []net.IP {
|
||||
filtered := make([]net.IP, 0, len(ips))
|
||||
for _, ip := range ips {
|
||||
if (len(ip) == net.IPv4len && option.IPv4Enable) || (len(ip) == net.IPv6len && option.IPv6Enable) {
|
||||
filtered = append(filtered, ip)
|
||||
parsed := net.IPAddress(ip)
|
||||
if (parsed.Family().IsIPv4() && option.IPv4Enable) || (parsed.Family().IsIPv6() && option.IPv6Enable) {
|
||||
filtered = append(filtered, parsed.IP())
|
||||
}
|
||||
}
|
||||
if len(filtered) == 0 {
|
||||
|
||||
Reference in new issue
Block a user