From ceb7044e5a2ed969e48b813c93ac3d338b1813ce Mon Sep 17 00:00:00 2001 From: Oluf Lorenzen Date: Tue, 11 Apr 2023 10:54:29 +0200 Subject: [PATCH] add flag to enable MulticastDNS --- README.md | 2 ++ mgr.go | 3 +++ template.network | 3 +++ 3 files changed, 8 insertions(+) diff --git a/README.md b/README.md index dd9f7a1..4c90ea3 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ Finally, run the tool as `root`: `zerotier-systemd-manager`. If you have interfa If you have a DNS-over-TLS configuration provided by zeronsd (v0.4.0 or later), you can enable using it by providing `-dns-over-tls=true` in the supervisor (a systemd timer in the default case). You will have to hand-edit this in for now. +If you want to enable multicast DNS / bonjour / mDNS you can enable it by providing `-multicast-dns`. + Finally, if you have left a DNS-controlled network it will try to remove the old files if `-reconcile=true` is set (the default). This way you can stuff it in cron and not think about it too much. Enjoy! diff --git a/mgr.go b/mgr.go index 21bb0db..de720cc 100644 --- a/mgr.go +++ b/mgr.go @@ -39,6 +39,7 @@ type templateScaffold struct { DNSSearch string MagicComment string DNSOverTLS bool + MulticastDNS bool } // wrapped openapi client. should probably be replaced with a code generator in @@ -73,6 +74,7 @@ func main() { autoRestartFlag := flag.Bool("auto-restart", true, "Automatically restart systemd-resolved when things change") reconcileFlag := flag.Bool("reconcile", true, "Automatically remove left networks from systemd-networkd configuration") dnsOverTLSFlag := flag.Bool("dns-over-tls", false, "Automatically prefer DNS-over-TLS. Requires ZeroNSd v0.4 or better") + multicastDNSFlag := flag.Bool("multicast-dns", false, "Enable mDNS resolution on the zerotier interface.") flag.Parse() if os.Geteuid() != 0 { @@ -205,6 +207,7 @@ func main() { DNSSearch: strings.Join(searchkeys, " "), MagicComment: magicComment, DNSOverTLS: *dnsOverTLSFlag, + MulticastDNS: *multicastDNSFlag, } buf := bytes.NewBuffer(nil) diff --git a/template.network b/template.network index 41ddb11..b74175d 100644 --- a/template.network +++ b/template.network @@ -12,6 +12,9 @@ DNS={{ $key }} {{ if .DNSOverTLS -}} DNSOverTLS=yes {{ end -}} +{{ if .MulticastDNS -}} +MulticastDNS=yes +{{ end -}} Domains=~{{ .DNSSearch }} ConfigureWithoutCarrier=true KeepConfiguration=static