Generated MagicDNS search domains (only in 100.64.0.0/10)
This commit is contained in:
parent
e432e98413
commit
45e71ecba0
2 changed files with 42 additions and 0 deletions
12
app.go
12
app.go
|
@ -16,6 +16,7 @@ import (
|
|||
"gorm.io/gorm"
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/types/dnstype"
|
||||
"tailscale.com/types/wgkey"
|
||||
)
|
||||
|
||||
|
@ -104,6 +105,17 @@ func NewHeadscale(cfg Config) (*Headscale, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if h.cfg.DNSConfig != nil && h.cfg.DNSConfig.Proxied { // if MagicDNS
|
||||
magicDNSDomains, err := h.generateMagicDNSRootDomains()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h.cfg.DNSConfig.Routes = make(map[string][]dnstype.Resolver)
|
||||
for _, d := range *magicDNSDomains {
|
||||
h.cfg.DNSConfig.Routes[d.WithoutTrailingDot()] = nil
|
||||
}
|
||||
}
|
||||
|
||||
return &h, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue