cmd/cli: save DNS settings only once

While at it, also fixing a bug in getting saved nameservers.
This commit is contained in:
Cuong Manh Le
2024-02-08 08:59:53 +07:00
committed by Cuong Manh Le
parent d55563cac5
commit 18e8616834
2 changed files with 9 additions and 3 deletions

View File

@@ -268,6 +268,14 @@ func initCLI() {
{s.Stop, false},
{func() error { return doGenerateNextDNSConfig(nextdns) }, true},
{func() error { return ensureUninstall(s) }, false},
{func() error {
// Save current DNS so we can restore later.
withEachPhysicalInterfaces("", "save DNS settings", func(i *net.Interface) error {
saveCurrentDNS(i)
return nil
})
return nil
}, false},
{s.Install, false},
{s.Start, true},
// Note that startCmd do not actually write ControlD config, but the config file was