From dcee58fdd3b0792ceaa568d18a3806cb516a7d3e Mon Sep 17 00:00:00 2001 From: tcely Date: Mon, 4 Mar 2019 07:15:32 -0500 Subject: [PATCH] adjust positive and negative TTL values NXDOMAIN shouldn't really impact normal usage, but waiting an hour for a new configuration record to show up is more acceptable. Let resolvers cache the TXT records for a short time to help with tight checking loops. --- dns.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dns.go b/dns.go index baf54a8..271ca22 100644 --- a/dns.go +++ b/dns.go @@ -55,7 +55,7 @@ func (d *DNSServer) ParseRecords(config DNSConfig) { // Create serial serial := time.Now().Format("2006010215") // Add SOA - SOAstring := fmt.Sprintf("%s. SOA %s. %s. %s 28800 7200 604800 86400", strings.ToLower(config.General.Domain), strings.ToLower(config.General.Nsname), strings.ToLower(config.General.Nsadmin), serial) + SOAstring := fmt.Sprintf("%s. SOA %s. %s. %s 28800 7200 604800 3600", strings.ToLower(config.General.Domain), strings.ToLower(config.General.Nsname), strings.ToLower(config.General.Nsadmin), serial) soarr, err := dns.NewRR(SOAstring) if err != nil { log.WithFields(log.Fields{"error": err.Error(), "soa": SOAstring}).Error("Error while adding SOA record") @@ -188,7 +188,7 @@ func (d *DNSServer) answerTXT(q dns.Question) ([]dns.RR, error) { for _, v := range atxt { if len(v) > 0 { r := new(dns.TXT) - r.Hdr = dns.RR_Header{Name: q.Name, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 1} + r.Hdr = dns.RR_Header{Name: q.Name, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 10} r.Txt = append(r.Txt, v) ra = append(ra, r) }