1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

Fix: failure of cache expired DNS record querying over DoQ

This commit is contained in:
秋のかえで 2022-04-02 12:46:24 +08:00
parent 975f78a7ce
commit b76b10b529
No known key found for this signature in database
GPG Key ID: E343534293081E5D

View File

@ -232,15 +232,7 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
var ips []net.Address
var lastErr error
if option.IPv6Enable && record.AAAA != nil && record.AAAA.RCode == dnsmessage.RCodeSuccess {
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 {
if option.IPv4Enable {
a, err := record.A.getIPs()
if err != nil {
lastErr = err
@ -248,6 +240,14 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
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 {
return toNetIP(ips)
}
@ -256,11 +256,7 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
return nil, lastErr
}
if (option.IPv4Enable && record.A != nil) || (option.IPv6Enable && record.AAAA != nil) {
return nil, dns_feature.ErrEmptyResponse
}
return nil, errRecordNotFound
return nil, dns_feature.ErrEmptyResponse
}
// QueryIP is called from dns.Server->queryIPTimeout