From a6856ebd9b06a7ad65c7cee6ab59bf8a4102e705 Mon Sep 17 00:00:00 2001 From: Larvan2 <78135608+Larvan2@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:01:09 +0800 Subject: [PATCH] fix redundant WindowsDNS (#1456) Co-authored-by: ForestL<45709305+forestl18@users.noreply.github.com> --- dns/system_windows.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dns/system_windows.go b/dns/system_windows.go index 47c1ebaa4e..2f4d1b633d 100644 --- a/dns/system_windows.go +++ b/dns/system_windows.go @@ -8,6 +8,7 @@ import ( "syscall" "unsafe" + "golang.org/x/exp/slices" "golang.org/x/sys/windows" ) @@ -40,6 +41,9 @@ func dnsReadConfig() (servers []string, err error) { // Unexpected type. continue } + if slices.Contains(servers, ip.String()) { + continue + } servers = append(servers, ip.String()) } }