net/dns: rename Set to SetDNS in OSConfigurator.

wgengine/router.CallbackRouter needs to support both the Router
and OSConfigurator interfaces, so the setters can't both be called
Set.

Signed-off-by: David Anderson <danderson@tailscale.com>
crawshaw/localapi404
David Anderson 3 years ago committed by Dave Anderson
parent 7d84ee6c98
commit b2a597b288

@ -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)

@ -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
}

@ -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{})
}

@ -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{})
}

@ -6,7 +6,7 @@ package dns
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 }

@ -23,11 +23,11 @@ const (
// 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

@ -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

@ -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()

Loading…
Cancel
Save