mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-01 14:05:39 +00:00
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>
This commit is contained in:
parent
7d84ee6c98
commit
b2a597b288
@ -114,7 +114,7 @@ func newDirectManager() directManager {
|
|||||||
return directManager{}
|
return directManager{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m directManager) Set(config OSConfig) error {
|
func (m directManager) SetDNS(config OSConfig) error {
|
||||||
// Write the tsConf file.
|
// Write the tsConf file.
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
writeResolvConf(buf, config.Nameservers, config.Domains)
|
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 {
|
if err := m.resolver.SetConfig(resolverCfg); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := m.os.Set(osCfg); err != nil {
|
if err := m.os.SetDNS(osCfg); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ func (m windowsManager) setDomains(basePath string, domains []string) error {
|
|||||||
return setRegistryString(path, "SearchList", value)
|
return setRegistryString(path, "SearchList", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m windowsManager) Set(config OSConfig) error {
|
func (m windowsManager) SetDNS(config OSConfig) error {
|
||||||
var ipsv4 []string
|
var ipsv4 []string
|
||||||
var ipsv6 []string
|
var ipsv6 []string
|
||||||
|
|
||||||
@ -118,5 +118,5 @@ func (m windowsManager) RoutingMode() RoutingMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m windowsManager) Close() error {
|
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
|
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)
|
ctx, cancel := context.WithTimeout(context.Background(), reconfigTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -203,5 +203,5 @@ func (m nmManager) Set(config OSConfig) error {
|
|||||||
func (m nmManager) RoutingMode() RoutingMode { return RoutingModeNone }
|
func (m nmManager) RoutingMode() RoutingMode { return RoutingModeNone }
|
||||||
|
|
||||||
func (m nmManager) Close() error {
|
func (m nmManager) Close() error {
|
||||||
return m.Set(OSConfig{})
|
return m.SetDNS(OSConfig{})
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
type noopManager struct{}
|
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) RoutingMode() RoutingMode { return RoutingModeNone }
|
||||||
func (m noopManager) Close() error { return nil }
|
func (m noopManager) Close() error { return nil }
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
// An OSConfigurator applies DNS settings to the operating system.
|
// An OSConfigurator applies DNS settings to the operating system.
|
||||||
type OSConfigurator interface {
|
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
|
// If cfg is the zero value, all Tailscale-related DNS
|
||||||
// configuration is removed.
|
// configuration is removed.
|
||||||
// Set must not be called after Close.
|
// SetDNS must not be called after Close.
|
||||||
Set(cfg OSConfig) error
|
SetDNS(cfg OSConfig) error
|
||||||
// DNSRoutingMode reports the DNS routing capabilities of this OS
|
// DNSRoutingMode reports the DNS routing capabilities of this OS
|
||||||
// configurator.
|
// configurator.
|
||||||
RoutingMode() RoutingMode
|
RoutingMode() RoutingMode
|
||||||
|
@ -115,7 +115,7 @@ func newResolvconfManager(logf logger.Logf) resolvconfManager {
|
|||||||
// when running resolvconfLegacy, hopefully placing our config first.
|
// when running resolvconfLegacy, hopefully placing our config first.
|
||||||
const resolvconfConfigName = "tun-tailscale.inet"
|
const resolvconfConfigName = "tun-tailscale.inet"
|
||||||
|
|
||||||
func (m resolvconfManager) Set(config OSConfig) error {
|
func (m resolvconfManager) SetDNS(config OSConfig) error {
|
||||||
stdin := new(bytes.Buffer)
|
stdin := new(bytes.Buffer)
|
||||||
writeResolvConf(stdin, config.Nameservers, config.Domains) // dns_direct.go
|
writeResolvConf(stdin, config.Nameservers, config.Domains) // dns_direct.go
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ func newResolvedManager() resolvedManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Up implements managerImpl.
|
// Up implements managerImpl.
|
||||||
func (m resolvedManager) Set(config OSConfig) error {
|
func (m resolvedManager) SetDNS(config OSConfig) error {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), reconfigTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), reconfigTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user