From 582bb8a9cdb38c6c9a6fced92ca345487e3317a8 Mon Sep 17 00:00:00 2001 From: Christian Heusel Date: Fri, 2 Dec 2022 02:03:26 +0100 Subject: [PATCH] add the possibility for custom DNS records related to https://github.com/juanfont/headscale/issues/762 Co-Authored-By: Jamie Greeff Signed-off-by: Christian Heusel --- config.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/config.go b/config.go index 6c975d1ea6..d4bc946be4 100644 --- a/config.go +++ b/config.go @@ -448,6 +448,20 @@ func GetDNSConfig() (*tailcfg.DNSConfig, string) { } } + if viper.IsSet("dns_config.extra_records") { + var extraRecords []tailcfg.DNSRecord + + err := viper.UnmarshalKey("dns_config.extra_records", &extraRecords) + if err != nil { + log.Error(). + Str("func", "getDNSConfig"). + Err(err). + Msgf("Could not parse dns_config.extra_records") + } + + dnsConfig.ExtraRecords = extraRecords + } + if viper.IsSet("dns_config.magic_dns") { dnsConfig.Proxied = viper.GetBool("dns_config.magic_dns") }