Added bootstrap DNS to the config file

DNS healthcheck now uses the upstream package methods
This commit is contained in:
Andrey Meshkov
2018-11-06 00:47:59 +03:00
parent 7f018234f6
commit 451922b858
5 changed files with 19 additions and 94 deletions

View File

@@ -93,7 +93,7 @@ func IsAlive(u Upstream) (bool, error) {
// If we got a header, we're alright, basically only care about I/O errors 'n stuff.
if err != nil && resp != nil {
// Silly check, something sane came back.
if resp.Response || resp.Opcode == dns.OpcodeQuery {
if resp.Rcode != dns.RcodeServerFailure {
err = nil
}
}

View File

@@ -10,6 +10,8 @@ import (
"github.com/miekg/dns"
)
// Persistent connections cache -- almost similar to the same used in the CoreDNS forward plugin
const (
defaultExpire = 10 * time.Second
minDialTimeout = 100 * time.Millisecond