From ce6a8379249cda0aa7dad4d55fb40b62565ef75c Mon Sep 17 00:00:00 2001 From: phga Date: Tue, 13 Apr 2021 22:11:00 +0200 Subject: [PATCH] fix: dns server is now configurable --- .gitignore | 2 +- cmd/dd/config.go | 1 + cmd/dd/dd.go | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 86eccc2..2cba05c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ configs/* -cmd/tt/tt \ No newline at end of file +cmd/dd/dd \ No newline at end of file diff --git a/cmd/dd/config.go b/cmd/dd/config.go index ff9f30f..1b4f0e1 100644 --- a/cmd/dd/config.go +++ b/cmd/dd/config.go @@ -17,6 +17,7 @@ type Config struct { MailSmtpPort string `json:"mail_smtp_port"` DdUsers map[string]map[string]string `json:"dd_users"` DnsTTL int `json:"dns_ttl"` + DnsServer string `json:"dns_server"` } var config Config diff --git a/cmd/dd/dd.go b/cmd/dd/dd.go index 83a14e5..e7106e0 100644 --- a/cmd/dd/dd.go +++ b/cmd/dd/dd.go @@ -58,10 +58,10 @@ func updateDnsRecord(domain string, ip string, hmac string, keyname string, secr } defer f.Close() - update := fmt.Sprintf(`server 127.0.0.1 + update := fmt.Sprintf(`server %s key %s:%s %s update add %s %d a %s - send`, hmac, keyname, secret, domain, config.DnsTTL, ip) + send`, config.DnsServer, hmac, keyname, secret, domain, config.DnsTTL, ip) _, err = io.WriteString(f, update) if err != nil {