mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 06:15:51 +00:00
fix: remove automatic retry when doh fails
This commit is contained in:
parent
e9de332163
commit
c8c18a4651
15
dns/dns.go
15
dns/dns.go
@ -93,16 +93,13 @@ 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
|
||||
return "", errors.New("no record found(doh)")
|
||||
}
|
||||
|
||||
return resp[0], nil
|
||||
resp, err := client.Resolve(ctx, domain, []uint16{dns.TypeA, dns.TypeAAAA})
|
||||
if err == nil {
|
||||
if len(resp) == 0 { // yes this happens
|
||||
return "", errors.New("no record found(doh)")
|
||||
}
|
||||
|
||||
return resp[0], nil
|
||||
}
|
||||
|
||||
return "", errors.New("could not resolve the domain(doh)")
|
||||
|
Loading…
Reference in New Issue
Block a user