diff --git a/net/dns/direct.go b/net/dns/direct.go index d896b8b59..058975bcd 100644 --- a/net/dns/direct.go +++ b/net/dns/direct.go @@ -114,7 +114,7 @@ func newDirectManager() directManager { return directManager{} } -func (m directManager) Set(config OSConfig) error { +func (m directManager) SetDNS(config OSConfig) error { // Write the tsConf file. buf := new(bytes.Buffer) writeResolvConf(buf, config.Nameservers, config.Domains) diff --git a/net/dns/manager.go b/net/dns/manager.go index ac8842ccf..111700e1f 100644 --- a/net/dns/manager.go +++ b/net/dns/manager.go @@ -86,7 +86,7 @@ func (m *Manager) Set(cfg Config) error { if err := m.resolver.SetConfig(resolverCfg); err != nil { return err } - if err := m.os.Set(osCfg); err != nil { + if err := m.os.SetDNS(osCfg); err != nil { return err } diff --git a/net/dns/manager_windows.go b/net/dns/manager_windows.go index ed11f4604..c5fcd3716 100644 --- a/net/dns/manager_windows.go +++ b/net/dns/manager_windows.go @@ -64,7 +64,7 @@ func (m windowsManager) setDomains(basePath string, domains []string) error { return setRegistryString(path, "SearchList", value) } -func (m windowsManager) Set(config OSConfig) error { +func (m windowsManager) SetDNS(config OSConfig) error { var ipsv4 []string var ipsv6 []string @@ -118,5 +118,5 @@ func (m windowsManager) RoutingMode() RoutingMode { } func (m windowsManager) Close() error { - return m.Set(OSConfig{}) + return m.SetDNS(OSConfig{}) } diff --git a/net/dns/nm.go b/net/dns/nm.go index a2342a9ba..4e008a25a 100644 --- a/net/dns/nm.go +++ b/net/dns/nm.go @@ -63,7 +63,7 @@ func newNMManager(interfaceName string) nmManager { type nmConnectionSettings map[string]map[string]dbus.Variant -func (m nmManager) Set(config OSConfig) error { +func (m nmManager) SetDNS(config OSConfig) error { ctx, cancel := context.WithTimeout(context.Background(), reconfigTimeout) defer cancel() @@ -203,5 +203,5 @@ func (m nmManager) Set(config OSConfig) error { func (m nmManager) RoutingMode() RoutingMode { return RoutingModeNone } func (m nmManager) Close() error { - return m.Set(OSConfig{}) + return m.SetDNS(OSConfig{}) } diff --git a/net/dns/noop.go b/net/dns/noop.go index 98c38d9ed..8a0fc213c 100644 --- a/net/dns/noop.go +++ b/net/dns/noop.go @@ -6,7 +6,7 @@ type noopManager struct{} -func (m noopManager) Set(OSConfig) error { return nil } +func (m noopManager) SetDNS(OSConfig) error { return nil } func (m noopManager) RoutingMode() RoutingMode { return RoutingModeNone } func (m noopManager) Close() error { return nil } diff --git a/net/dns/osconfig.go b/net/dns/osconfig.go index ae08c6da7..00eb8f44e 100644 --- a/net/dns/osconfig.go +++ b/net/dns/osconfig.go @@ -23,11 +23,11 @@ // An OSConfigurator applies DNS settings to the operating system. type OSConfigurator interface { - // Set updates the OS's DNS configuration to match cfg. + // SetDNS updates the OS's DNS configuration to match cfg. // If cfg is the zero value, all Tailscale-related DNS // configuration is removed. - // Set must not be called after Close. - Set(cfg OSConfig) error + // SetDNS must not be called after Close. + SetDNS(cfg OSConfig) error // DNSRoutingMode reports the DNS routing capabilities of this OS // configurator. RoutingMode() RoutingMode diff --git a/net/dns/resolvconf.go b/net/dns/resolvconf.go index aeddf47be..23de5b95d 100644 --- a/net/dns/resolvconf.go +++ b/net/dns/resolvconf.go @@ -115,7 +115,7 @@ func newResolvconfManager(logf logger.Logf) resolvconfManager { // when running resolvconfLegacy, hopefully placing our config first. const resolvconfConfigName = "tun-tailscale.inet" -func (m resolvconfManager) Set(config OSConfig) error { +func (m resolvconfManager) SetDNS(config OSConfig) error { stdin := new(bytes.Buffer) writeResolvConf(stdin, config.Nameservers, config.Domains) // dns_direct.go diff --git a/net/dns/resolved.go b/net/dns/resolved.go index b2990bb98..ddae9b2e5 100644 --- a/net/dns/resolved.go +++ b/net/dns/resolved.go @@ -84,7 +84,7 @@ func newResolvedManager() resolvedManager { } // Up implements managerImpl. -func (m resolvedManager) Set(config OSConfig) error { +func (m resolvedManager) SetDNS(config OSConfig) error { ctx, cancel := context.WithTimeout(context.Background(), reconfigTimeout) defer cancel()