juewuy / ShellCrash

Run sing-box/mihomo as client in shell
8.92k stars 1.48k forks source link

[Bug] DNS解析速度非常慢 #768

Closed Cathgao closed 1 month ago

Cathgao commented 1 month ago

Verify steps

Description

脚本版本:1.9.1rc2 内核版本:mihomo v1.18.8 代理模式:Redir DNS模式:redir_host 当前基础DNS:https://223.5.5.5/dns-query, https://doh.pub/dns-query, tls://dns.rubyfish.cn:853 PROXY-DNS:tls://1.0.0.1:853, tls://8.8.4.4:853, https://doh.opendns.com/dns-query

表现为国内外网站(包括京东、bilibili等)解析都会非常慢,浏览器转圈可达5秒以上才有显示。安装ADGH后查看解析日志,发现有很多达到千毫秒级别的记录,且响应为SERVFAIL 请教一下是哪里出了问题? image image

完整config.yaml:

mixed-port: 7890
redir-port: 7892
tproxy-port: 7893
authentication: [""]
allow-lan: true
mode: Rule
log-level: info
ipv6: true
external-controller: :9999
external-ui: ui
secret: 
tun: {enable: false}
experimental: {ignore-resolve-fail: true, interface-name: en0}
sniffer: {enable: true, parse-pure-ip: true, skip-domain: [Mijia Cloud], sniff: {tls: {ports: [443, 8443]}, http: {ports: [80, 8080-8880]}, quic: {ports: [443, 8443]}}}
find-process-mode: "off"
routing-mark: 7894
hosts:
   'time.android.com': 203.107.6.88
   'time.facebook.com': 203.107.6.88  
   [某个内网服务]: 192.168.31.2
   'miwifi.com': 192.168.31.1
dns:
  enable: true
  listen: :1053
  use-hosts: true
  ipv6: true
  default-nameserver:
    - 114.114.114.114
    - 223.5.5.5
  enhanced-mode: redir-host
  fake-ip-range: 198.18.0.1/16
  fake-ip-filter:
    - '+.*'
  nameserver: [https://223.5.5.5/dns-query, https://doh.pub/dns-query, tls://dns.rubyfish.cn:853,https://hk-hkg.doh.sb/dns-query]
  fallback: [tls://1.0.0.1:853, tls://8.8.4.4:853, https://doh.opendns.com/dns-query]
  fallback-filter:
    geoip: true
    domain:
      - '+.bing.com'
      - '+.linkedin.com'
proxies:
    - {name: 🇯🇵 日本节点, server: [****], port: 38926, reality-opts: {public-key: [****], short-id: [****]}, client-fingerprint: chrome, type: vless, uuid: [****], tls: true, tfo: false, flow: xtls-rprx-vision, skip-cert-verify: false, servername: www.apple.com, network: tcp}

proxy-groups:
  - {name: 🚀 节点选择, type: select, proxies: [🇯🇵 日本节点]}
  - {name: 🐟 漏网之鱼, type: select, proxies: [🚀 节点选择, 🎯 全球直连]}
  - {name: 📈 网络测试, type: select, proxies: [🎯 全球直连, 🇯🇵 日本节点]}
  - {name: 🤖 人工智能, type: select, proxies: [🚀 节点选择, 🇯🇵 日本节点]}
  - {name: 🎮 游戏服务, type: select, proxies: [🎯 全球直连, 🚀 节点选择]}
  - {name: 🪟 微软服务, type: select, proxies: [🎯 全球直连, 🚀 节点选择]}
  - {name: 🇬 谷歌服务, type: select, proxies: [🎯 全球直连, 🚀 节点选择]}
  - {name: 🍎 苹果服务, type: select, proxies: [🎯 全球直连, 🚀 节点选择]}
  - {name: 🎥 奈飞视频, type: select, proxies: [🚀 节点选择]}
  - {name: 📽️ 迪士尼+, type: select, proxies: [🚀 节点选择]}
  - {name: 🎞️ Max, type: select, proxies: [🚀 节点选择]}
  - {name: 🎬 Prime Video, type: select, proxies: [🚀 节点选择]}
  - {name: 🍎 Apple TV+, type: select, proxies: [🚀 节点选择]}
  - {name: 📹 油管视频, type: select, proxies: [🚀 节点选择]}
  - {name: 🎵 TikTok, type: select, proxies: [🚀 节点选择]}
  - {name: 📺 哔哩哔哩, type: select, proxies: [🎯 全球直连, 🚀 节点选择]}
  - {name: 🇨🇳 直连域名, type: select, proxies: [🎯 全球直连, 🚀 节点选择]}
  - {name: 🇨🇳 直连 IP, type: select, proxies: [🎯 全球直连, 🚀 节点选择]}
  - {name: 🪜 代理域名, type: select, proxies: [🚀 节点选择, 🎯 全球直连]}
  - {name: 📲 电报消息, type: select, proxies: [🚀 节点选择]}
  - {name: 🖥️ 直连软件, type: select, proxies: [🎯 全球直连]}
  - {name: 🔒 私有网络, type: select, proxies: [🎯 全球直连]}
  - {name: 🛑 广告拦截, type: select, proxies: [REJECT]}
  - {name: 🎯 全球直连, type: select, proxies: [DIRECT]}

rules:
 - DOMAIN-KEYWORD,pixiv, 🇯🇵 日本节点 #自定义规则
 - DOMAIN-KEYWORD,parsec,DIRECT #自定义规则
 - DOMAIN-SUFFIX,hath.network, 🇯🇵 日本节点 #自定义规则
 - DOMAIN-SUFFIX,[我的顶域],DIRECT #自定义规则
 - DOMAIN-SUFFIX,sharepoint.com,DIRECT #自定义规则
 - DOMAIN-SUFFIX,fastly-download.epicgames.com,DIRECT #自定义规则
 - DOMAIN,hk-hkg.doh.sb,DIRECT #自定义规则
 #自定义规则
 #自定义规则
 #自定义规则
 #自定义规则
 - RULE-SET,ads,🛑 广告拦截
 - RULE-SET,applications,🖥️ 直连软件
 - RULE-SET,private,🔒 私有网络
 - RULE-SET,microsoft-cn,🪟 微软服务
 - RULE-SET,apple-cn,🍎 苹果服务
 - RULE-SET,google-cn,🇬 谷歌服务
 - RULE-SET,games-cn,🎮 游戏服务
 - RULE-SET,netflix,🎥 奈飞视频
 - RULE-SET,disney,📽️ 迪士尼+
 - RULE-SET,max,🎞️ Max
 - RULE-SET,primevideo,🎬 Prime Video
 - RULE-SET,appletv,🍎 Apple TV+
 - RULE-SET,youtube,📹 油管视频
 - RULE-SET,tiktok,🎵 TikTok
 - RULE-SET,bilibili,📺 哔哩哔哩
 - RULE-SET,ai,🤖 人工智能
 - RULE-SET,networktest,📈 网络测试
 - RULE-SET,proxy,🪜 代理域名
 - RULE-SET,cn,🇨🇳 直连域名
 - RULE-SET,netflixip,🎥 奈飞视频,no-resolve
 - RULE-SET,telegramip,📲 电报消息,no-resolve
 - RULE-SET,privateip,🔒 私有网络,no-resolve
 - RULE-SET,cnip,🇨🇳 直连 IP
rule-providers:
  fakeip-filter:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/fakeip-filter.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/fakeip-filter.mrs"
    interval: 86400

  ads:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/ads.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/ads.mrs"
    interval: 86400

  applications:
    type: http
    behavior: classical
    format: text
    path: ./rules/applications.list
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/applications.list"
    interval: 86400

  private:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/private.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/private.mrs"
    interval: 86400

  microsoft-cn:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/microsoft-cn.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/microsoft-cn.mrs"
    interval: 86400

  apple-cn:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/apple-cn.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/apple-cn.mrs"
    interval: 86400

  google-cn:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/google-cn.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/google-cn.mrs"
    interval: 86400

  games-cn:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/games-cn.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/games-cn.mrs"
    interval: 86400

  netflix:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/netflix.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/netflix.mrs"
    interval: 86400

  disney:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/disney.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/disney.mrs"
    interval: 86400

  max:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/max.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/max.mrs"
    interval: 86400

  primevideo:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/primevideo.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/primevideo.mrs"
    interval: 86400

  appletv:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/appletv.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/appletv.mrs"
    interval: 86400

  youtube:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/youtube.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/youtube.mrs"
    interval: 86400

  tiktok:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/tiktok.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/tiktok.mrs"
    interval: 86400

  bilibili:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/bilibili.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/bilibili.mrs"
    interval: 86400

  ai:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/ai.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/ai.mrs"
    interval: 86400

  networktest:
    type: http
    behavior: classical
    format: text
    path: ./rules/networktest.list
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/networktest.list"
    interval: 86400

  proxy:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/proxy.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/proxy.mrs"
    interval: 86400

  cn:
    type: http
    behavior: domain
    format: mrs
    path: ./rules/cn.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/cn.mrs"
    interval: 86400

  netflixip:
    type: http
    behavior: ipcidr
    format: mrs
    path: ./rules/netflixip.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/netflixip.mrs"
    interval: 86400

  telegramip:
    type: http
    behavior: ipcidr
    format: mrs
    path: ./rules/telegramip.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/telegramip.mrs"
    interval: 86400

  privateip:
    type: http
    behavior: ipcidr
    format: mrs
    path: ./rules/privateip.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/privateip.mrs"
    interval: 86400

  cnip:
    type: http
    behavior: ipcidr
    format: mrs
    path: ./rules/cnip.mrs
    url: "https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/cnip.mrs"
    interval: 86400
Cathgao commented 1 month ago

已经查明SERVFAIL是rubyfish不可用导致的,但删除rubyfish只留腾讯和阿里依然是查询非常慢 image

juewuy commented 1 month ago

@Cathgao 这个东西肯定因人而异,你可以尝试换成你本地运营商提供的DNS,前提是不在意DNS污染

Cathgao commented 1 month ago

@Cathgao 这个东西肯定因人而异,你可以尝试换成你本地运营商提供的DNS,前提是不在意DNS污染

但如果我关掉clash直接用这两个DOH的话就快的多,最慢不超过800ms,浏览器上也有很直观的体现

juewuy commented 1 month ago

浏览

可以尝试更换使用singbox内核

Cathgao commented 1 month ago

换了singboxP来分流,解析确实快了很多,不知道mihomo啥问题