mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-17 14:57:44 -05:00
Fix: failure of cache expired DNS record querying over DoQ
This commit is contained in:
parent
975f78a7ce
commit
b76b10b529
@ -232,15 +232,7 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
|
|||||||
|
|
||||||
var ips []net.Address
|
var ips []net.Address
|
||||||
var lastErr error
|
var lastErr error
|
||||||
if option.IPv6Enable && record.AAAA != nil && record.AAAA.RCode == dnsmessage.RCodeSuccess {
|
if option.IPv4Enable {
|
||||||
aaaa, err := record.AAAA.getIPs()
|
|
||||||
if err != nil {
|
|
||||||
lastErr = err
|
|
||||||
}
|
|
||||||
ips = append(ips, aaaa...)
|
|
||||||
}
|
|
||||||
|
|
||||||
if option.IPv4Enable && record.A != nil && record.A.RCode == dnsmessage.RCodeSuccess {
|
|
||||||
a, err := record.A.getIPs()
|
a, err := record.A.getIPs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
lastErr = err
|
lastErr = err
|
||||||
@ -248,6 +240,14 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
|
|||||||
ips = append(ips, a...)
|
ips = append(ips, a...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if option.IPv6Enable {
|
||||||
|
aaaa, err := record.AAAA.getIPs()
|
||||||
|
if err != nil {
|
||||||
|
lastErr = err
|
||||||
|
}
|
||||||
|
ips = append(ips, aaaa...)
|
||||||
|
}
|
||||||
|
|
||||||
if len(ips) > 0 {
|
if len(ips) > 0 {
|
||||||
return toNetIP(ips)
|
return toNetIP(ips)
|
||||||
}
|
}
|
||||||
@ -256,11 +256,7 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
|
|||||||
return nil, lastErr
|
return nil, lastErr
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option.IPv4Enable && record.A != nil) || (option.IPv6Enable && record.AAAA != nil) {
|
return nil, dns_feature.ErrEmptyResponse
|
||||||
return nil, dns_feature.ErrEmptyResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, errRecordNotFound
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryIP is called from dns.Server->queryIPTimeout
|
// QueryIP is called from dns.Server->queryIPTimeout
|
||||||
|
Loading…
Reference in New Issue
Block a user