mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
DNS: Support returning upstream TTL to clients (#4526)
Closes https://github.com/XTLS/Xray-core/issues/4527
This commit is contained in:
parent
2d3210e4b8
commit
4afe2d0cff
24 changed files with 168 additions and 157 deletions
|
@ -71,13 +71,13 @@ func (h *Handler) policy() policy.Session {
|
|||
}
|
||||
|
||||
func (h *Handler) resolveIP(ctx context.Context, domain string, localAddr net.Address) net.Address {
|
||||
ips, err := h.dns.LookupIP(domain, dns.IPOption{
|
||||
ips, _, err := h.dns.LookupIP(domain, dns.IPOption{
|
||||
IPv4Enable: (localAddr == nil || localAddr.Family().IsIPv4()) && h.config.preferIP4(),
|
||||
IPv6Enable: (localAddr == nil || localAddr.Family().IsIPv6()) && h.config.preferIP6(),
|
||||
})
|
||||
{ // Resolve fallback
|
||||
if (len(ips) == 0 || err != nil) && h.config.hasFallback() && localAddr == nil {
|
||||
ips, err = h.dns.LookupIP(domain, dns.IPOption{
|
||||
ips, _, err = h.dns.LookupIP(domain, dns.IPOption{
|
||||
IPv4Enable: h.config.fallbackIP4(),
|
||||
IPv6Enable: h.config.fallbackIP6(),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue