cmd/cli: preserve static DNS on Windows/Mac

This commit is contained in:
Cuong Manh Le
2024-02-07 14:29:20 +07:00
committed by Cuong Manh Le
parent 891b7cb2c6
commit a163be3584
3 changed files with 44 additions and 0 deletions
+5
View File
@@ -69,6 +69,11 @@ func resetDNS(iface *net.Interface) error {
}
})
if ns := savedNameservers(iface); len(ns) > 0 {
if err := setDNS(iface, ns); err == nil {
return nil
}
}
if ctrldnet.SupportsIPv6ListenLocal() {
if output, err := netsh("interface", "ipv6", "set", "dnsserver", strconv.Itoa(iface.Index), "dhcp"); err != nil {
mainLog.Load().Warn().Err(err).Msgf("failed to reset ipv6 DNS: %s", string(output))