net/dns: remove PerDomain from Config.

It's currently unused, and no longer makes sense with the upcoming
DNS infrastructure. Keep it in tailcfg for now, since we need protocol
compat for a bit longer.

Signed-off-by: David Anderson <danderson@tailscale.com>
pull/1644/head
David Anderson 4 years ago
parent f77ba75d6c
commit cf361bb9b1

@ -1452,7 +1452,6 @@ func (b *LocalBackend) authReconfig() {
rcfg.DNS = dns.Config{
Nameservers: nm.DNS.Nameservers,
Domains: nm.DNS.Domains,
PerDomain: nm.DNS.PerDomain,
Proxied: proxied,
}
}

@ -17,11 +17,6 @@ type Config struct {
Nameservers []netaddr.IP
// Domains are the search domains to use.
Domains []string
// PerDomain indicates whether it is preferred to use Nameservers
// only for DNS queries for subdomains of Domains.
// Note that Nameservers may still be applied to all queries
// if the manager does not support per-domain settings.
PerDomain bool
// Proxied indicates whether DNS requests are proxied through a dns.Resolver.
// This enables MagicDNS.
Proxied bool
@ -30,7 +25,7 @@ type Config struct {
// Equal determines whether its argument and receiver
// represent equivalent DNS configurations (then DNS reconfig is a no-op).
func (lhs Config) Equal(rhs Config) bool {
if lhs.Proxied != rhs.Proxied || lhs.PerDomain != rhs.PerDomain {
if lhs.Proxied != rhs.Proxied {
return false
}
@ -71,7 +66,4 @@ type ManagerConfig struct {
// Cleanup indicates that the manager is created for cleanup only.
// A no-op manager will be instantiated if the system needs no cleanup.
Cleanup bool
// PerDomain indicates that a manager capable of per-domain configuration is preferred.
// Certain managers are per-domain only; they will not be considered if this is false.
PerDomain bool
}

@ -47,8 +47,6 @@ func NewManager(mconfig ManagerConfig) *Manager {
m := &Manager{
logf: mconfig.Logf,
impl: newManager(mconfig),
config: Config{PerDomain: mconfig.PerDomain},
mconfig: mconfig,
}
@ -72,16 +70,6 @@ func (m *Manager) Set(config Config) error {
return err
}
// Switching to and from per-domain mode may require a change of manager.
if config.PerDomain != m.config.PerDomain {
if err := m.impl.Down(); err != nil {
return err
}
m.mconfig.PerDomain = config.PerDomain
m.impl = newManager(m.mconfig)
m.logf("switched to %T", m.impl)
}
err := m.impl.Up(config)
// If we save the config, we will not retry next time. Only do this on success.
if err == nil {

@ -6,8 +6,7 @@ package dns
func newManager(mconfig ManagerConfig) managerImpl {
switch {
// systemd-resolved should only activate per-domain.
case isResolvedActive() && mconfig.PerDomain:
case isResolvedActive():
if mconfig.Cleanup {
return newNoopManager(mconfig)
} else {

@ -769,13 +769,12 @@ type DNSConfig struct {
Nameservers []netaddr.IP `json:",omitempty"`
// Domains are the search domains to use.
Domains []string `json:",omitempty"`
// PerDomain indicates whether it is preferred to use Nameservers
// only for DNS queries for subdomains of Domains.
// Some OSes and OS configurations don't support per-domain DNS configuration,
// in which case Nameservers applies to all DNS requests regardless of PerDomain's value.
// PerDomain is not set by the control server, and does nothing.
// TODO(danderson): revise DNS configuration to make this useful
// again.
PerDomain bool
// Proxied indicates whether DNS requests are proxied through a dns.Resolver.
// This enables MagicDNS. It is togglable independently of PerDomain.
// This enables MagicDNS.
Proxied bool
}

Loading…
Cancel
Save