Skip to content

Commit

Permalink
Merge pull request #22 from Finkregh/add-mdns-flag
Browse files Browse the repository at this point in the history
add flag to enable MulticastDNS
  • Loading branch information
laduke authored Jun 27, 2023
2 parents 7edf477 + ceb7044 commit ef57478
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
3 changes: 3 additions & 0 deletions mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -205,6 +207,7 @@ func main() {
DNSSearch: strings.Join(searchkeys, " "),
MagicComment: magicComment,
DNSOverTLS: *dnsOverTLSFlag,
MulticastDNS: *multicastDNSFlag,
}

buf := bytes.NewBuffer(nil)
Expand Down
3 changes: 3 additions & 0 deletions template.network
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ DNS={{ $key }}
{{ if .DNSOverTLS -}}
DNSOverTLS=yes
{{ end -}}
{{ if .MulticastDNS -}}
MulticastDNS=yes
{{ end -}}
Domains=~{{ .DNSSearch }}
ConfigureWithoutCarrier=true
KeepConfiguration=static

0 comments on commit ef57478

Please sign in to comment.