mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-20 11:58:39 +00:00
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>
This commit is contained in:
parent
f77ba75d6c
commit
cf361bb9b1
@ -1452,7 +1452,6 @@ func (b *LocalBackend) authReconfig() {
|
|||||||
rcfg.DNS = dns.Config{
|
rcfg.DNS = dns.Config{
|
||||||
Nameservers: nm.DNS.Nameservers,
|
Nameservers: nm.DNS.Nameservers,
|
||||||
Domains: nm.DNS.Domains,
|
Domains: nm.DNS.Domains,
|
||||||
PerDomain: nm.DNS.PerDomain,
|
|
||||||
Proxied: proxied,
|
Proxied: proxied,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,6 @@ type Config struct {
|
|||||||
Nameservers []netaddr.IP
|
Nameservers []netaddr.IP
|
||||||
// Domains are the search domains to use.
|
// Domains are the search domains to use.
|
||||||
Domains []string
|
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.
|
// Proxied indicates whether DNS requests are proxied through a dns.Resolver.
|
||||||
// This enables MagicDNS.
|
// This enables MagicDNS.
|
||||||
Proxied bool
|
Proxied bool
|
||||||
@ -30,7 +25,7 @@ type Config struct {
|
|||||||
// Equal determines whether its argument and receiver
|
// Equal determines whether its argument and receiver
|
||||||
// represent equivalent DNS configurations (then DNS reconfig is a no-op).
|
// represent equivalent DNS configurations (then DNS reconfig is a no-op).
|
||||||
func (lhs Config) Equal(rhs Config) bool {
|
func (lhs Config) Equal(rhs Config) bool {
|
||||||
if lhs.Proxied != rhs.Proxied || lhs.PerDomain != rhs.PerDomain {
|
if lhs.Proxied != rhs.Proxied {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +66,4 @@ type ManagerConfig struct {
|
|||||||
// Cleanup indicates that the manager is created for cleanup only.
|
// Cleanup indicates that the manager is created for cleanup only.
|
||||||
// A no-op manager will be instantiated if the system needs no cleanup.
|
// A no-op manager will be instantiated if the system needs no cleanup.
|
||||||
Cleanup bool
|
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
|
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,8 @@ type Manager struct {
|
|||||||
func NewManager(mconfig ManagerConfig) *Manager {
|
func NewManager(mconfig ManagerConfig) *Manager {
|
||||||
mconfig.Logf = logger.WithPrefix(mconfig.Logf, "dns: ")
|
mconfig.Logf = logger.WithPrefix(mconfig.Logf, "dns: ")
|
||||||
m := &Manager{
|
m := &Manager{
|
||||||
logf: mconfig.Logf,
|
logf: mconfig.Logf,
|
||||||
impl: newManager(mconfig),
|
impl: newManager(mconfig),
|
||||||
|
|
||||||
config: Config{PerDomain: mconfig.PerDomain},
|
|
||||||
mconfig: mconfig,
|
mconfig: mconfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,16 +70,6 @@ func (m *Manager) Set(config Config) error {
|
|||||||
return err
|
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)
|
err := m.impl.Up(config)
|
||||||
// If we save the config, we will not retry next time. Only do this on success.
|
// If we save the config, we will not retry next time. Only do this on success.
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -6,8 +6,7 @@ package dns
|
|||||||
|
|
||||||
func newManager(mconfig ManagerConfig) managerImpl {
|
func newManager(mconfig ManagerConfig) managerImpl {
|
||||||
switch {
|
switch {
|
||||||
// systemd-resolved should only activate per-domain.
|
case isResolvedActive():
|
||||||
case isResolvedActive() && mconfig.PerDomain:
|
|
||||||
if mconfig.Cleanup {
|
if mconfig.Cleanup {
|
||||||
return newNoopManager(mconfig)
|
return newNoopManager(mconfig)
|
||||||
} else {
|
} else {
|
||||||
|
@ -769,13 +769,12 @@ type DNSConfig struct {
|
|||||||
Nameservers []netaddr.IP `json:",omitempty"`
|
Nameservers []netaddr.IP `json:",omitempty"`
|
||||||
// Domains are the search domains to use.
|
// Domains are the search domains to use.
|
||||||
Domains []string `json:",omitempty"`
|
Domains []string `json:",omitempty"`
|
||||||
// PerDomain indicates whether it is preferred to use Nameservers
|
// PerDomain is not set by the control server, and does nothing.
|
||||||
// only for DNS queries for subdomains of Domains.
|
// TODO(danderson): revise DNS configuration to make this useful
|
||||||
// Some OSes and OS configurations don't support per-domain DNS configuration,
|
// again.
|
||||||
// in which case Nameservers applies to all DNS requests regardless of PerDomain's value.
|
|
||||||
PerDomain bool
|
PerDomain bool
|
||||||
// Proxied indicates whether DNS requests are proxied through a dns.Resolver.
|
// 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
|
Proxied bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user