mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
tailcfg: add FallbackResolvers to DNSConfig.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
3d0599fca0
commit
28ba20d733
@ -849,6 +849,10 @@ type DNSConfig struct {
|
|||||||
// Map keys must be fully-qualified DNS name suffixes, with a
|
// Map keys must be fully-qualified DNS name suffixes, with a
|
||||||
// trailing dot but no leading dot.
|
// trailing dot but no leading dot.
|
||||||
Routes map[string][]DNSResolver `json:",omitempty"`
|
Routes map[string][]DNSResolver `json:",omitempty"`
|
||||||
|
// FallbackResolvers is like Resolvers, but is only used if a
|
||||||
|
// split DNS configuration is requested in a configuration that
|
||||||
|
// doesn't work yet without explicit default resolvers.
|
||||||
|
FallbackResolvers []DNSResolver `json:",omitempty"`
|
||||||
// Domains are the search domains to use.
|
// Domains are the search domains to use.
|
||||||
// Search domains must be FQDNs, but *without* the trailing dot.
|
// Search domains must be FQDNs, but *without* the trailing dot.
|
||||||
Domains []string `json:",omitempty"`
|
Domains []string `json:",omitempty"`
|
||||||
@ -865,8 +869,6 @@ type DNSConfig struct {
|
|||||||
Nameservers []netaddr.IP `json:",omitempty"`
|
Nameservers []netaddr.IP `json:",omitempty"`
|
||||||
|
|
||||||
// PerDomain is not set by the control server, and does nothing.
|
// PerDomain is not set by the control server, and does nothing.
|
||||||
// TODO(danderson): revise DNS configuration to make this useful
|
|
||||||
// again.
|
|
||||||
PerDomain bool `json:",omitempty"`
|
PerDomain bool `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,6 +198,10 @@ func (src *DNSConfig) Clone() *DNSConfig {
|
|||||||
dst.Routes[k] = append([]DNSResolver{}, src.Routes[k]...)
|
dst.Routes[k] = append([]DNSResolver{}, src.Routes[k]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dst.FallbackResolvers = make([]DNSResolver, len(src.FallbackResolvers))
|
||||||
|
for i := range dst.FallbackResolvers {
|
||||||
|
dst.FallbackResolvers[i] = *src.FallbackResolvers[i].Clone()
|
||||||
|
}
|
||||||
dst.Domains = append(src.Domains[:0:0], src.Domains...)
|
dst.Domains = append(src.Domains[:0:0], src.Domains...)
|
||||||
dst.Nameservers = append(src.Nameservers[:0:0], src.Nameservers...)
|
dst.Nameservers = append(src.Nameservers[:0:0], src.Nameservers...)
|
||||||
return dst
|
return dst
|
||||||
@ -206,12 +210,13 @@ func (src *DNSConfig) Clone() *DNSConfig {
|
|||||||
// A compilation failure here means this code must be regenerated, with command:
|
// A compilation failure here means this code must be regenerated, with command:
|
||||||
// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,DNSResolver,RegisterResponse
|
// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,DNSResolver,RegisterResponse
|
||||||
var _DNSConfigNeedsRegeneration = DNSConfig(struct {
|
var _DNSConfigNeedsRegeneration = DNSConfig(struct {
|
||||||
Resolvers []DNSResolver
|
Resolvers []DNSResolver
|
||||||
Routes map[string][]DNSResolver
|
Routes map[string][]DNSResolver
|
||||||
Domains []string
|
FallbackResolvers []DNSResolver
|
||||||
Proxied bool
|
Domains []string
|
||||||
Nameservers []netaddr.IP
|
Proxied bool
|
||||||
PerDomain bool
|
Nameservers []netaddr.IP
|
||||||
|
PerDomain bool
|
||||||
}{})
|
}{})
|
||||||
|
|
||||||
// Clone makes a deep copy of DNSResolver.
|
// Clone makes a deep copy of DNSResolver.
|
||||||
|
Loading…
Reference in New Issue
Block a user