all: unify code to handle static DNS file path

This commit is contained in:
Cuong Manh Le
2025-05-05 17:36:02 +07:00
committed by Cuong Manh Le
parent 5ce92abf1f
commit 6286a71f2a
8 changed files with 27 additions and 46 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"os/exec"
"strings"
"github.com/Control-D-Inc/ctrld"
"github.com/Control-D-Inc/ctrld/internal/resolvconffile"
)
@@ -84,7 +85,7 @@ func resetDNS(iface *net.Interface) error {
// restoreDNS restores the DNS settings of the given interface.
// this should only be executed upon turning off the ctrld service.
func restoreDNS(iface *net.Interface) (err error) {
if ns := savedStaticNameservers(iface); len(ns) > 0 {
if ns := ctrld.SavedStaticNameservers(iface); len(ns) > 0 {
err = setDNS(iface, ns)
}
return err