1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-02 22:21:19 +00: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 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