Compare commits

..

No commits in common. "79a3cc9f92d2e8f39520893b6f00c25334d6b1ae" and "d3b49b5bf4808ab92d7602ad488b4fdad44dcb11" have entirely different histories.

4 changed files with 6 additions and 15 deletions

6
cfg.go
View File

@ -9,12 +9,12 @@ import (
const ( const (
cfgListen = "127.0.0.1:8086" cfgListen = "127.0.0.1:8086"
cfgTtlMin uint32 = 120 cfgTtlMin uint32 = 60
cfgTtlMax uint32 = 1800 cfgTtlMax uint32 = 3600
cfgResolverEndpoint = "127.1.0.1:53" cfgResolverEndpoint = "127.1.0.1:53"
cfgResolverProto = "tcp" cfgResolverProto = "tcp"
cfgResolverTimeout = 1900 * time.Millisecond cfgResolverTimeout = 2000 * time.Millisecond
cfgNftTable = "uni" cfgNftTable = "uni"
cfgNftTableFamily = nft.TableFamilyINet cfgNftTableFamily = nft.TableFamilyINet

View File

@ -72,7 +72,7 @@ func dnsRemap(qname string, qtype uint16, orig *dns.Msg) ([]PowerDnsAnswer, erro
r := DnsAnswer{ r := DnsAnswer{
Qname: qname, Qname: qname,
Qtype: t, Qtype: t,
Ttl: dnsClipTtl(rr.Header().Ttl), Ttl: rr.Header().Ttl,
} }
switch r.Qtype { switch r.Qtype {
case dns.TypeA: case dns.TypeA:

11
dns.go
View File

@ -7,7 +7,6 @@ import (
"net" "net"
"strings" "strings"
"sync" "sync"
"time"
"github.com/miekg/dns" "github.com/miekg/dns"
) )
@ -52,15 +51,7 @@ func dnsCustomResolve(qname string, qtype uint16) (*dns.Msg, error) {
req.Question = make([]dns.Question, 1) req.Question = make([]dns.Question, 1)
req.Question[0] = dns.Question{Name: qname, Qtype: qtype, Qclass: dns.ClassINET} req.Question[0] = dns.Question{Name: qname, Qtype: qtype, Qclass: dns.ClassINET}
var resp *dns.Msg resp, rtt, err := c.Exchange(req, cfgResolverEndpoint)
var rtt time.Duration
var err error
for i := 0; i < 2; i++ {
resp, rtt, err = c.Exchange(req, cfgResolverEndpoint)
if err == nil {
break
}
}
if err != nil { if err != nil {
log.Printf("resolving %v/%v (rtt %v) with error: %v", qname, qtype_s, rtt, err) log.Printf("resolving %v/%v (rtt %v) with error: %v", qname, qtype_s, rtt, err)
return nil, err return nil, err

View File

@ -1,5 +1,5 @@
launch=remote launch=remote
remote-connection-string=http:url=http://127.0.0.1:8086/dns,post,post_json,timeout=5000 remote-connection-string=http:url=http://127.0.0.1:8086/dns,post,post_json,timeout=3000
consistent-backends=false consistent-backends=false
zone-cache-refresh-interval=0 zone-cache-refresh-interval=0