Merge pull request #89 from denquixote/lessmagicdnsresolver

dns_challenge preCheckDNS: let system resolver decide IPv4 ./. IPv6.
This commit is contained in:
xenolf 2016-01-30 23:51:30 +01:00
commit b2bdf0c809
2 changed files with 7 additions and 1 deletions

View file

@ -73,7 +73,7 @@ func checkDNS(domain, fqdn string) bool {
m := new(dns.Msg) m := new(dns.Msg)
m.SetQuestion(domain+".", dns.TypeSOA) m.SetQuestion(domain+".", dns.TypeSOA)
c := new(dns.Client) c := new(dns.Client)
in, _, err := c.Exchange(m, "8.8.8.8:53") in, _, err := c.Exchange(m, "google-public-dns-a.google.com:53")
if err != nil { if err != nil {
return false return false
} }

View file

@ -37,3 +37,9 @@ func TestDNSValidServerResponse(t *testing.T) {
t.Errorf("VALID: Expected Solve to return no error but the error was -> %v", err) t.Errorf("VALID: Expected Solve to return no error but the error was -> %v", err)
} }
} }
func TestPreCheckDNS(t *testing.T) {
if !preCheckDNS("api.letsencrypt.org", "acme-staging.api.letsencrypt.org") {
t.Errorf("preCheckDNS failed for acme-staging.api.letsencrypt.org")
}
}