Compare commits
2 Commits
d3b49b5bf4
...
79a3cc9f92
Author | SHA1 | Date | |
---|---|---|---|
79a3cc9f92 | |||
8a2e37fa88 |
6
cfg.go
6
cfg.go
@ -9,12 +9,12 @@ import (
|
||||
const (
|
||||
cfgListen = "127.0.0.1:8086"
|
||||
|
||||
cfgTtlMin uint32 = 60
|
||||
cfgTtlMax uint32 = 3600
|
||||
cfgTtlMin uint32 = 120
|
||||
cfgTtlMax uint32 = 1800
|
||||
|
||||
cfgResolverEndpoint = "127.1.0.1:53"
|
||||
cfgResolverProto = "tcp"
|
||||
cfgResolverTimeout = 2000 * time.Millisecond
|
||||
cfgResolverTimeout = 1900 * time.Millisecond
|
||||
|
||||
cfgNftTable = "uni"
|
||||
cfgNftTableFamily = nft.TableFamilyINet
|
||||
|
@ -72,7 +72,7 @@ func dnsRemap(qname string, qtype uint16, orig *dns.Msg) ([]PowerDnsAnswer, erro
|
||||
r := DnsAnswer{
|
||||
Qname: qname,
|
||||
Qtype: t,
|
||||
Ttl: rr.Header().Ttl,
|
||||
Ttl: dnsClipTtl(rr.Header().Ttl),
|
||||
}
|
||||
switch r.Qtype {
|
||||
case dns.TypeA:
|
||||
|
11
dns.go
11
dns.go
@ -7,6 +7,7 @@ import (
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
@ -51,7 +52,15 @@ func dnsCustomResolve(qname string, qtype uint16) (*dns.Msg, error) {
|
||||
req.Question = make([]dns.Question, 1)
|
||||
req.Question[0] = dns.Question{Name: qname, Qtype: qtype, Qclass: dns.ClassINET}
|
||||
|
||||
resp, rtt, err := c.Exchange(req, cfgResolverEndpoint)
|
||||
var resp *dns.Msg
|
||||
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 {
|
||||
log.Printf("resolving %v/%v (rtt %v) with error: %v", qname, qtype_s, rtt, err)
|
||||
return nil, err
|
||||
|
@ -1,5 +1,5 @@
|
||||
launch=remote
|
||||
remote-connection-string=http:url=http://127.0.0.1:8086/dns,post,post_json,timeout=3000
|
||||
remote-connection-string=http:url=http://127.0.0.1:8086/dns,post,post_json,timeout=5000
|
||||
consistent-backends=false
|
||||
zone-cache-refresh-interval=0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user