fix redundant WindowsDNS (#1456)

Co-authored-by: ForestL <45709305+forestl18@users.noreply.github.com>
This commit is contained in:
Larvan2 2024-08-20 21:13:26 +08:00
parent ba605b693b
commit 512d188384

View File

@ -8,6 +8,7 @@ import (
"syscall" "syscall"
"unsafe" "unsafe"
"golang.org/x/exp/slices"
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
) )
@ -40,6 +41,9 @@ func dnsReadConfig() (servers []string, err error) {
// Unexpected type. // Unexpected type.
continue continue
} }
if slices.Contains(servers, ip.String()) {
continue
}
servers = append(servers, ip.String()) servers = append(servers, ip.String())
} }
} }