Add support for Split DNS (implements #179)

This commit is contained in:
Juan Font Alonso
2021-10-19 20:51:43 +02:00
parent 9e1253ada1
commit 18b00b5d8d
3 changed files with 51 additions and 16 deletions

4
app.go
View File

@@ -113,7 +113,9 @@ func NewHeadscale(cfg Config) (*Headscale, error) {
if err != nil {
return nil, err
}
h.cfg.DNSConfig.Routes = make(map[string][]dnstype.Resolver)
if h.cfg.DNSConfig.Routes == nil { // we might have routes already from Split DNS
h.cfg.DNSConfig.Routes = make(map[string][]dnstype.Resolver)
}
for _, d := range magicDNSDomains {
h.cfg.DNSConfig.Routes[d.WithoutTrailingDot()] = nil
}