Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no network caused by loop dns problem #759

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mzz2017
Copy link
Contributor

@mzz2017 mzz2017 commented Feb 20, 2025

Background

daeuniverse/outbound#36

有一种可能的循环依赖情况:
dae 在解析节点域名的时候走了 resolv.conf,然后到了本地的 smartdns,smartdns 用国外 doh 被劫持代理到 dae,而代理需要过节点,而过节点需要解析节点域名……

本次为 direct dialer 添加一个选项 WithCache,该选项开启后,会记录 direct dialer 的上次成功的 host 对应的 ip,并在因dns查询超时而失败时对相同 host 用缓存的 ip 进行重试。对所有节点默认开启

注:direct dialer 是 proxy dialer 的最后一层,连节点用的

Checklist

Full Changelogs

  • [Implement ...]

Issue Reference

Closes #[issue number]

Test Result

@mzz2017 mzz2017 requested a review from a team as a code owner February 20, 2025 16:21
@mzz2017 mzz2017 force-pushed the mzz/fix_loop_dns_problem branch from 1925e3a to badf345 Compare February 20, 2025 16:23
@davidtall
Copy link

davidtall commented Feb 28, 2025

使用黑名单模式时,域名网内的机器访问www.google.com ,不定时出现无法访问的问题,国内域名baidu.com 正常,关闭浏览器重新打开又能正常访问edge 和chrome 都出现过。而使用白名单模式,默认fallback: proxy 就不会出现这个问题。不知道是否和上述的问题是否有关联。openwrt 内核6.12系统,开启dnsmasq ,已取消重定向绑定, /etc/resolve.conf 默认指向127.0.0.1

dns {
  upstream {
  cndns: 'udp://127.0.0.1:53' # dnsmasq
  googledns: 'tcp+udp://8.8.8.8:53'
}

  routing {
    request {
    qname(geosite:category-ads-all) -> reject
    qname(geosite:private) -> local
    qname(geosite:geolocation-!cn) -> googledns
    fallback: cndns
    }
   }	
}

routing {
  pname(NetworkManager, systemd-resolved, dnsmasq) -> must_direct
  dip(geoip:private) -> direct
  dip(8.8.8.8,1.1.1.1) -> proxy
  l4proto(udp) && dport(443) && !dip(geoip:cn) -> block
  domain(geosite:category-ads-all) -> block
  domain(geosite:geolocation-!cn) -> proxy
  fallback: direct
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants