fix: remove automatic retry when doh fails

This commit is contained in:
ohaiibuzzle 2024-08-12 22:33:31 +07:00
parent e9de332163
commit c8c18a4651

View File

@ -93,8 +93,6 @@ func dohLookup(domain string) (string, error) {
dnsUpstream := util.GetConfig().DnsAddr
client := GetDoHClient(*dnsUpstream)
// try up to 3 times
for i := 0; i < 3; i++ {
resp, err := client.Resolve(ctx, domain, []uint16{dns.TypeA, dns.TypeAAAA})
if err == nil {
if len(resp) == 0 { // yes this happens
@ -103,7 +101,6 @@ func dohLookup(domain string) (string, error) {
return resp[0], nil
}
}
return "", errors.New("could not resolve the domain(doh)")
}