MetaCubeX / mihomo

A simple Python Pydantic model for Honkai: Star Rail parsed data from the Mihomo API.
https://wiki.metacubex.one
MIT License
16.52k stars 2.65k forks source link

在启用dns:["enable": true]自定义DNS时,DNS解析出IP地址,但显示i/o timeout #1195

Closed tanmoumou252 closed 6 months ago

tanmoumou252 commented 6 months ago

Verify steps

Mihomo version

1.18.3

What OS are you seeing the problem on?

Windows

Mihomo config

dns:
  enable: true
  ipv6: true
  listen: 0.0.0.0:8053
  default-nameserver :
    - 1.1.1.1
    - 223.5.5.5
  enhanced-mode: fake-ip
  # 配置不使用fake-ip的域名
  fake-ip-filter:
    - '+.*'
    - '*.lan'
    - localhost.ptlogin2.qq.com
  nameserver:
    - 223.5.5.5
    - 1.1.1.1
    - 8.8.8.8
    - 114.114.114.114
    - 119.29.29.29
  fallback:   # 与 nameserver 内的服务器列表同时发起请求,当规则符合 GEOIP 在 CN 以外时,fallback 列表内的域名服务器生效。    
    - https://dns.google/dns-query
    - https://1.1.1.1/dns-query
    - tcp://8.8.8.8:53
    - tcp://8.8.4.4:53
    - tcp://208.67.222.222:443
    - tcp://208.67.220.220:443
  fallback-filter:
    geoip: true
    geoip-code: CN
    ipcidr:
      - 240.0.0.0/4
    domain:
      - '+.google.com'
      - '+.googleapis.com'
      - '+.youtube.com'
      - '+.appspot.com'
      - '+.telegram.com'
      - '+.facebook.com'
      - '+.twitter.com'
      - '+.blogger.com'
      - '+.gmail.com'
      - '+.gvt1.com'

rules: #-Lan_CN *为省略,非通配符
  - DOMAIN-SUFFIX,*.com #CF托管
  - DOMAIN,*.v6.army #dynv6二级域名

Mihomo log

dial DIRECT (match RuleSet/Lan_CN) 192.168.123.1:4486 --> *.v6.army:8920 error: connect failed: dial tcp [ipv6]:8920: i/o timeout

Description

  1. 该报错域名为dynv6申请的二级域名,端口上是自己搭建的jellyfin服务器.访问环境为内网或者本机.
  2. 若在yaml中删除整段DNS的配置,则解析正常. 未删除时设置的223.5.5.5和1.1.1.1亦为电脑和路由器的DNS服务器,所以即便在配置中不自定义DNS,直连解析域名的时候使用的也应该是阿里和CF的解析,更何况已经解析到IP地址了.
  3. 与此同时还有一个CF托管的一级域名,其和dynv6没有区别,实际IP地址,访问的端口均相同,二者均已存在已解析的DNS记录.而该域名则没有i/o timeout的报错.

该问题在cmfa 2.10.0 上也存在,为什么相同IPv6相同端口的两个域名,在解析出实际IP的情况下,一个会报错,一个正常. 禁用自定义dns虽然会正常,但实际使用的dns和被禁用的dns却又是相同的

Skyxim commented 6 months ago

由于 IP 被隐藏,且报错为 io timeout,只能说明其 IP 可能无法连接,或者连接时间过长(如果没记错会包含 DNS 解析时间)

tanmoumou252 commented 6 months ago

由于 IP 被隐藏,且报错为 io timeout,只能说明其 IP 可能无法连接,或者连接时间过长(如果没记错会包含 DNS 解析时间)

该自定义DNS来自于padavan路由器clash自带的DNS覆写配置(即无论订阅链接如何,路由器都会删除其中DNS部分,默认使用我贴出来的这一段配置)

meta核,版本为alpha-c893e3c 在该版本上解析两个网站均正常

日志为路由器clash debug 自带yacd面板日志 时间为倒序 可以以此为参照

解析 v6.army

24-04-16 22:07:57[ debug ][DNS] 替代.v6.army --> 2408:8252:***:b9c6
24-04-16 22:07:55[ debug ][DNS] 替代.v6.army --> [] A from tcp://208.67.222.222:443
24-04-16 22:07:53[ debug ][DNS] cache hit for dns.google., expire at 2024-04-16 14:09:32
24-04-16 22:07:53[ debug ][DNS] cache hit for dns.google., expire at 2024-04-16 14:08:49
24-04-16 22:07:53[ debug ][DNS] resolve 替代.v6.army from tcp://8.8.4.4:53
24-04-16 22:07:52[ debug ][DNS] 替代.v6.army --> [2408:8252:***:b9c6] AAAA from udp://114.114.114.114:53
24-04-16 22:07:52[ debug ][DNS] 替代.v6.army --> [] A from udp://223.5.5.5:53
24-04-16 22:07:52[ debug ][DNS] 替代.v6.army --> [] A from udp://114.114.114.114:53
24-04-16 22:07:52[ debug ][DNS] resolve 替代.v6.army from udp://114.114.114.114:53
24-04-16 22:07:52[ debug ][DNS] cache hit for 替代.v6.army., expire at 2024-04-16 14:05:18
24-04-16 22:07:52[ debug ][Process] find process 替代.v6.army error: socket: protocol not supported
24-04-16 22:07:52[ debug ][Rule] use default rules

解析 .com

24-04-16 22:22:48[ debug ][DNS] 替代.com --> [] A from udp://223.5.5.5:53
24-04-16 22:22:48[ debug ][DNS] resolve 替代.com from udp://223.5.5.5:53
24-04-16 22:22:43[ debug ][DNS] 替代.com --> [] A from udp://223.5.5.5:53
24-04-16 22:22:43[ debug ][DNS] 替代.com --> [] A from udp://114.114.114.114:53
24-04-16 22:22:43[ info ][TCP] 192.168.123.2:10210 --> 替代.com:8920 match RuleSet(Lan_CN) using DIRECT
24-04-16 22:22:43[ debug ][DNS] resolve 替代.com from udp://114.114.114.114:53
24-04-16 22:22:43[ debug ][DNS] resolve 替代.com from udp://223.5.5.5:53
24-04-16 22:22:43[ debug ][DNS] resolve 替代.com from https://1.0.0.1:443/dns-query
24-04-16 22:22:43[ debug ][DNS] 替代.com --> 2408:8252:***:b9c6
24-04-16 22:22:39[ debug ][DNS] 替代.com --> [] A from udp://119.29.29.29:53
24-04-16 22:22:38[ debug ][DNS] 替代.com --> [] A from udp://114.114.114.114:53
24-04-16 22:22:38[ debug ][DNS] 替代.com --> [2408:8252:***:b9c6] AAAA from udp://223.5.5.5:53
24-04-16 22:22:38[ debug ][DNS] resolve 替代.com from udp://119.29.29.29:53
24-04-16 22:22:38[ debug ][Process] find process 替代.com error: socket: protocol not supported

以上为正常解析的meta日志

以下为不正常解析的mihomo 1.18.3 yacd.haishan面板日志,时间倒序

解析 v6.army

24-04-17 00:00:34
warning
[TCP] dial DIRECT (match RuleSet/Lan_CN) 192.168.123.1:27743 --> 替代.v6.army:8920 error: connect failed: dial tcp [2408:8252:***:b9c6]:8920: i/o timeout
24-04-17 00:00:34
debug
[DNS] 替代.v6.army --> [] A from tcp://8.8.4.4:53
24-04-17 00:00:32
debug
[DNS] 替代.v6.army --> [] A from tcp://8.8.8.8:53
24-04-17 00:00:29
debug
[DNS] 替代.v6.army --> [] A from udp://114.114.114.114:53
24-04-17 00:00:29
debug
[DNS] resolve 替代.v6.army from udp://114.114.114.114:53
24-04-17 00:00:29
debug
[DNS] resolve 替代.v6.army from udp://223.6.6.6:53
24-04-17 00:00:29
debug
[DNS] resolve 替代.v6.army from udp://119.29.29.29:53

解析 .com

24-04-16 23:15:27
debug
[DNS] resolve 替代.com from udp://223.5.5.5:53
24-04-16 23:15:27
debug
[DNS] 替代.com --> 2408:8252:***:b9c6
24-04-16 23:15:27
debug
[DNS] cache hit for 替代.com., expire at 2024-04-16 23:11:16
24-04-16 23:15:27
debug
[DNS] cache hit for 替代.com., expire at 2024-04-16 23:34:51
24-04-16 23:15:27
debug
[Process] find process 替代.com error: process not found
24-04-16 23:15:16
debug
[DNS] jellyfin.替代.com --> [2408:8252:***:b9c6] AAAA from udp://114.114.114.114:53
24-04-16 23:15:16
info
[TCP] 192.168.123.1:26417 --> jellyfin.替代.com:8920 match RuleSet(Lan_CN) using DIRECT
24-04-16 23:15:16
debug
[DNS] resolve jellyfin.替代.com from udp://223.5.5.5:53
24-04-16 23:15:16
debug
[DNS] jellyfin.替代.com --> 2408:8252:***:b9c6
24-04-16 23:15:16
debug
[DNS] cache hit for jellyfin.替代.com., expire at 2024-04-16 23:14:22
24-04-16 23:15:16
debug
[DNS] cache hit for jellyfin.替代.com., expire at 2024-04-16 23:34:52
24-04-16 23:15:16

使用这个正常和不正常的内核时,代理协议均为socks5,默认勾选代理DNS

若不选择socks5代理,改用gui的系统代理,报错变更为dns resolve failed: context deadline exceeded

24-04-16 23:54:54
warning
[TCP] dial DIRECT (match RuleSet/Lan_CN) 127.0.0.1:9685(firefox.exe) --> 替代.v6.army:8920 error: dns resolve failed: context deadline exceeded
24-04-16 23:54:50
debug
[DNS] 替代.v6.army --> [] A from tcp://8.8.4.4:53
24-04-16 23:54:50
debug
[DNS] 替代.v6.army --> [] A from tcp://208.67.220.220:443
24-04-16 23:54:50
debug
[DNS] 替代.v6.army --> [] A from tcp://208.67.222.222:443
24-04-16 23:54:49
debug
[DNS] 替代.v6.army --> [] A from udp://114.114.114.114:53
tanmoumou252 commented 6 months ago

其实这个本身不是什么很影响使用的问题,但是就很奇怪,为什么这样一份DNS配置,在meta上就二者都正常,在mihomo上就对.com域名正常,而在处理v6.army的时候就歇逼.