forked from TrueCloudLab/lego
dns_challenge preCheckDNS: let system resolver decide IPv4 ./. IPv6.
We can ask the OS resolver for the IP of Google's public anycast DNS. No need to "bootstrap" with literal IP address. The OS resolver knows best about IPv4 ./. IPv6. Mostly fixes #88.
This commit is contained in:
parent
316cb44f80
commit
0e53e51ba5
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue