mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-24 08:47:49 +00:00
Send search domains
This commit is contained in:
parent
45e71ecba0
commit
36ae14bccf
18
api.go
18
api.go
@ -241,11 +241,27 @@ func (h *Headscale) getMapResponse(mKey wgkey.Key, req tailcfg.MapRequest, m Mac
|
|||||||
DisplayName: m.Namespace.Name,
|
DisplayName: m.Namespace.Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dnsConfig *tailcfg.DNSConfig
|
||||||
|
if h.cfg.DNSConfig.Proxied { // if MagicDNS is enabled
|
||||||
|
// TODO(juanfont): We should not be regenerating this all the time
|
||||||
|
// And we should only send the domains of the peers (this own namespace + those from the shared peers)
|
||||||
|
namespaces, err := h.ListNamespaces()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
dnsConfig := h.cfg.DNSConfig.Clone()
|
||||||
|
for _, ns := range *namespaces {
|
||||||
|
dnsConfig.Domains = append(dnsConfig.Domains, fmt.Sprintf("%s.%s", ns.Name, h.cfg.BaseDomain))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dnsConfig = h.cfg.DNSConfig
|
||||||
|
}
|
||||||
|
|
||||||
resp := tailcfg.MapResponse{
|
resp := tailcfg.MapResponse{
|
||||||
KeepAlive: false,
|
KeepAlive: false,
|
||||||
Node: node,
|
Node: node,
|
||||||
Peers: *peers,
|
Peers: *peers,
|
||||||
DNSConfig: h.cfg.DNSConfig,
|
DNSConfig: dnsConfig,
|
||||||
Domain: h.cfg.BaseDomain,
|
Domain: h.cfg.BaseDomain,
|
||||||
PacketFilter: *h.aclRules,
|
PacketFilter: *h.aclRules,
|
||||||
DERPMap: h.cfg.DerpMap,
|
DERPMap: h.cfg.DerpMap,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user