mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-27 12:05:26 +00:00
Tailscale 1.26 uses dnstype pointer
This commit is contained in:
parent
43fa7f9fd5
commit
8d58894daa
2
app.go
2
app.go
@ -168,7 +168,7 @@ func NewHeadscale(cfg *Config) (*Headscale, error) {
|
|||||||
magicDNSDomains := generateMagicDNSRootDomains(app.cfg.IPPrefixes)
|
magicDNSDomains := generateMagicDNSRootDomains(app.cfg.IPPrefixes)
|
||||||
// we might have routes already from Split DNS
|
// we might have routes already from Split DNS
|
||||||
if app.cfg.DNSConfig.Routes == nil {
|
if app.cfg.DNSConfig.Routes == nil {
|
||||||
app.cfg.DNSConfig.Routes = make(map[string][]dnstype.Resolver)
|
app.cfg.DNSConfig.Routes = make(map[string][]*dnstype.Resolver)
|
||||||
}
|
}
|
||||||
for _, d := range magicDNSDomains {
|
for _, d := range magicDNSDomains {
|
||||||
app.cfg.DNSConfig.Routes[d.WithoutTrailingDot()] = nil
|
app.cfg.DNSConfig.Routes[d.WithoutTrailingDot()] = nil
|
||||||
|
10
config.go
10
config.go
@ -303,7 +303,7 @@ func GetDNSConfig() (*tailcfg.DNSConfig, string) {
|
|||||||
nameserversStr := viper.GetStringSlice("dns_config.nameservers")
|
nameserversStr := viper.GetStringSlice("dns_config.nameservers")
|
||||||
|
|
||||||
nameservers := make([]netaddr.IP, len(nameserversStr))
|
nameservers := make([]netaddr.IP, len(nameserversStr))
|
||||||
resolvers := make([]dnstype.Resolver, len(nameserversStr))
|
resolvers := make([]*dnstype.Resolver, len(nameserversStr))
|
||||||
|
|
||||||
for index, nameserverStr := range nameserversStr {
|
for index, nameserverStr := range nameserversStr {
|
||||||
nameserver, err := netaddr.ParseIP(nameserverStr)
|
nameserver, err := netaddr.ParseIP(nameserverStr)
|
||||||
@ -315,7 +315,7 @@ func GetDNSConfig() (*tailcfg.DNSConfig, string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nameservers[index] = nameserver
|
nameservers[index] = nameserver
|
||||||
resolvers[index] = dnstype.Resolver{
|
resolvers[index] = &dnstype.Resolver{
|
||||||
Addr: nameserver.String(),
|
Addr: nameserver.String(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,13 +326,13 @@ func GetDNSConfig() (*tailcfg.DNSConfig, string) {
|
|||||||
|
|
||||||
if viper.IsSet("dns_config.restricted_nameservers") {
|
if viper.IsSet("dns_config.restricted_nameservers") {
|
||||||
if len(dnsConfig.Nameservers) > 0 {
|
if len(dnsConfig.Nameservers) > 0 {
|
||||||
dnsConfig.Routes = make(map[string][]dnstype.Resolver)
|
dnsConfig.Routes = make(map[string][]*dnstype.Resolver)
|
||||||
restrictedDNS := viper.GetStringMapStringSlice(
|
restrictedDNS := viper.GetStringMapStringSlice(
|
||||||
"dns_config.restricted_nameservers",
|
"dns_config.restricted_nameservers",
|
||||||
)
|
)
|
||||||
for domain, restrictedNameservers := range restrictedDNS {
|
for domain, restrictedNameservers := range restrictedDNS {
|
||||||
restrictedResolvers := make(
|
restrictedResolvers := make(
|
||||||
[]dnstype.Resolver,
|
[]*dnstype.Resolver,
|
||||||
len(restrictedNameservers),
|
len(restrictedNameservers),
|
||||||
)
|
)
|
||||||
for index, nameserverStr := range restrictedNameservers {
|
for index, nameserverStr := range restrictedNameservers {
|
||||||
@ -343,7 +343,7 @@ func GetDNSConfig() (*tailcfg.DNSConfig, string) {
|
|||||||
Err(err).
|
Err(err).
|
||||||
Msgf("Could not parse restricted nameserver IP: %s", nameserverStr)
|
Msgf("Could not parse restricted nameserver IP: %s", nameserverStr)
|
||||||
}
|
}
|
||||||
restrictedResolvers[index] = dnstype.Resolver{
|
restrictedResolvers[index] = &dnstype.Resolver{
|
||||||
Addr: nameserver.String(),
|
Addr: nameserver.String(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ func (s *Suite) TestDNSConfigMapResponseWithMagicDNS(c *check.C) {
|
|||||||
|
|
||||||
baseDomain := "foobar.headscale.net"
|
baseDomain := "foobar.headscale.net"
|
||||||
dnsConfigOrig := tailcfg.DNSConfig{
|
dnsConfigOrig := tailcfg.DNSConfig{
|
||||||
Routes: make(map[string][]dnstype.Resolver),
|
Routes: make(map[string][]*dnstype.Resolver),
|
||||||
Domains: []string{baseDomain},
|
Domains: []string{baseDomain},
|
||||||
Proxied: true,
|
Proxied: true,
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ func (s *Suite) TestDNSConfigMapResponseWithoutMagicDNS(c *check.C) {
|
|||||||
|
|
||||||
baseDomain := "foobar.headscale.net"
|
baseDomain := "foobar.headscale.net"
|
||||||
dnsConfigOrig := tailcfg.DNSConfig{
|
dnsConfigOrig := tailcfg.DNSConfig{
|
||||||
Routes: make(map[string][]dnstype.Resolver),
|
Routes: make(map[string][]*dnstype.Resolver),
|
||||||
Domains: []string{baseDomain},
|
Domains: []string{baseDomain},
|
||||||
Proxied: false,
|
Proxied: false,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user