MetaCubeX / mihomo

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

[Bug] 多次连接上游dns拦截的域名 #943

Closed naa-nac closed 8 months ago

naa-nac commented 8 months ago

Verify steps

Mihomo version

Mihomo Meta alpha-2e87c6f linux amd64 with go1.21.5 Wed Dec 27 08:29:22 UTC 2023 Use tags: with_gvisor

What OS are you seeing the problem on?

Linux

Mihomo config

mixed-port: 7890
allow-lan: true
bind-address: "*"
mode: rule
geox-url:
  geoip: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat"
  geosite: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat"
  mmdb: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.metadb"
geo-auto-update: false
geo-update-interval: 24
log-level: debug
ipv6: true
external-controller: 192.168.18.166:9093
secret: "123456"
external-ui: ui
external-ui-name: xd
external-ui-url: "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip"
global-client-fingerprint: chrome
keep-alive-interval: 15
profile:
  store-selected: false
  store-fake-ip: false
dns:
  cache-algorithm: arc
  enable: true
  listen: 0.0.0.0:53
  ipv6: true
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  nameserver:
    - 192.168.18.91
proxies:
  - name: "test" xxxxxxxxxxxxxxxxxx
proxy-groups:
  - name: "Proxies"
    type: select
    proxies:
      - 'test'
  - name: "Domestic"
    type: select
    proxies:
      - 'DIRECT'
      - 'Proxies'
rule-providers:
  proxy:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt"
    path: ./ruleset/proxy.yaml
    interval: 14400
  direct:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt"
    path: ./ruleset/direct.yaml
    interval: 14400
rules:
  - RULE-SET,proxy,Proxies
  - RULE-SET,direct,Domestic
  - MATCH,Proxies

Mihomo log

No response

Description

发现这个情况是在ios safari上打开www.baidu.com域名 进度条会卡在中间 网页未加载完毕 等待25-29秒 进度条走完 网页加载完毕

查询日志发现日志中存在大量查找连接拦截域名的日志 在这段时间内一直在尝试连接拦截域名

其中自定上游dns 192.168.18.91:53 配置了 广告域名返回reject 0 log中这些 feed.baidu.com hm.baidu.com 域名都是配置的拦截域名

ios使用透明代理或使用系统配置代理 连接mihomo都会出现这种情况 尝试关闭 mihomo 内置 dns 也是同样的问题

同样的配置在原版clas核心上尝试 加载时间体感不到1秒 网页就加载完毕 日志时间是20:08:03开始20:08:04结束 mihomo上测试是20:12:01开始20:12:27结束 不应该尝试这么长时间连接没有找到ip的域名 是我配置的不对还是存在BUG

需要测试什么请再告诉我

查找连接拦截域名的日志中间省略 ### 连接一次www.baidu.com的日志 中间省略 20:12:01开始20:12:27结束 ``` time="2023-12-30T20:12:01.691573955+08:00" level=debug msg="[Rule] use default rules" time="2023-12-30T20:12:01.691623746+08:00" level=debug msg="[DNS] cache hit for www.baidu.com., expire at 2023-12-30 20:02:30" time="2023-12-30T20:12:01.691625366+08:00" level=debug msg="[DNS] cache hit for www.baidu.com., expire at 2023-12-30 20:02:30" time="2023-12-30T20:12:01.691669036+08:00" level=debug msg="[DNS] resolve www.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:01.691705076+08:00" level=debug msg="[DNS] resolve www.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:01.691906108+08:00" level=debug msg="[DNS] www.baidu.com --> [110.242.68.3 110.242.68.4] A from udp://192.168.18.91:53" time="2023-12-30T20:12:01.691928648+08:00" level=debug msg="[DNS] www.baidu.com --> [2408:871a:2100:3:0:ff:b025:348d 2408:871a:2100:2:0:ff:b09f:237] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:01.705981997+08:00" level=info msg="[TCP] 192.168.18.71:63354 --> www.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-30T20:12:02.166414981+08:00" level=debug msg="[Rule] use default rules" time="2023-12-30T20:12:02.166469091+08:00" level=debug msg="[DNS] cache hit for t10.baidu.com., expire at 2023-12-30 20:02:30" time="2023-12-30T20:12:02.166476251+08:00" level=debug msg="[DNS] cache hit for t10.baidu.com., expire at 2023-12-30 20:02:30" time="2023-12-30T20:12:02.166508792+08:00" level=debug msg="[DNS] resolve t10.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.166587512+08:00" level=debug msg="[DNS] resolve t10.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.166812364+08:00" level=debug msg="[DNS] t10.baidu.com --> [2408:8722:5800:2::3da3:3324] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:02.166837294+08:00" level=debug msg="[DNS] t10.baidu.com --> [119.249.50.36] A from udp://192.168.18.91:53" time="2023-12-30T20:12:02.172313462+08:00" level=debug msg="[Rule] use default rules" time="2023-12-30T20:12:02.172356952+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.172392762+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.172519533+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] A from udp://192.168.18.91:53" time="2023-12-30T20:12:02.172530703+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:02.172549833+08:00" level=warning msg="[TCP] dial Domestic (match RuleSet/direct) 192.168.18.71:63356 --> hpd.baidu.com:443 error: dns resolve failed: couldn't find ip" time="2023-12-30T20:12:02.175080261+08:00" level=info msg="[TCP] 192.168.18.71:63355 --> t10.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-30T20:12:02.17628987+08:00" level=debug msg="[Rule] use default rules" time="2023-12-30T20:12:02.17632074+08:00" level=debug msg="[DNS] cache hit for hectorstatic.baidu.com., expire at 2023-12-30 20:02:30" time="2023-12-30T20:12:02.17634447+08:00" level=debug msg="[DNS] cache hit for hectorstatic.baidu.com., expire at 2023-12-30 20:02:30" time="2023-12-30T20:12:02.17634866+08:00" level=debug msg="[DNS] resolve hectorstatic.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.17639135+08:00" level=debug msg="[DNS] resolve hectorstatic.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.176518041+08:00" level=debug msg="[DNS] hectorstatic.baidu.com --> [2408:8719:5300:9::70f0:3a26] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:02.176561342+08:00" level=debug msg="[DNS] hectorstatic.baidu.com --> [112.240.58.38] A from udp://192.168.18.91:53" time="2023-12-30T20:12:02.17778934+08:00" level=debug msg="[Rule] use default rules" time="2023-12-30T20:12:02.177818531+08:00" level=debug msg="[DNS] cache hit for b.bdstatic.com., expire at 2023-12-30 20:02:30" time="2023-12-30T20:12:02.177840891+08:00" level=debug msg="[DNS] resolve b.bdstatic.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.177845721+08:00" level=debug msg="[DNS] cache hit for b.bdstatic.com., expire at 2023-12-30 20:02:30" time="2023-12-30T20:12:02.177885191+08:00" level=debug msg="[DNS] resolve b.bdstatic.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.177976612+08:00" level=debug msg="[DNS] b.bdstatic.com --> [2408:8719:6c00:103::77b0:1930] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:02.178024922+08:00" level=debug msg="[DNS] b.bdstatic.com --> [39.91.128.48] A from udp://192.168.18.91:53" time="2023-12-30T20:12:02.183594991+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.183635842+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.183731612+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] A from udp://192.168.18.91:53" time="2023-12-30T20:12:02.183774663+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:02.183798633+08:00" level=warning msg="[TCP] dial Domestic (match RuleSet/direct) 192.168.18.71:63356 --> hpd.baidu.com:443 error: dns resolve failed: couldn't find ip" time="2023-12-30T20:12:02.189561443+08:00" level=info msg="[TCP] 192.168.18.71:63357 --> hectorstatic.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-30T20:12:02.191019724+08:00" level=info msg="[TCP] 192.168.18.71:63358 --> b.bdstatic.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-30T20:12:02.199928957+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.199965227+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.200061657+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] A from udp://192.168.18.91:53" time="2023-12-30T20:12:02.200098078+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:02.200120568+08:00" level=warning msg="[TCP] dial Domestic (match RuleSet/direct) 192.168.18.71:63356 --> hpd.baidu.com:443 error: dns resolve failed: couldn't find ip" time="2023-12-30T20:12:02.21889642+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.218927551+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:02.219036681+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] A from udp://192.168.18.91:53" time="2023-12-30T20:12:02.219058212+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:02.219076612+08:00" level=warning msg="[TCP] dial Domestic (match RuleSet/direct) 192.168.18.71:63356 --> hpd.baidu.com:443 error: dns resolve failed: couldn't find ip" ''''''''' time="2023-12-30T20:12:24.27760548+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:24.277690221+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:24.277867162+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] A from udp://192.168.18.91:53" time="2023-12-30T20:12:24.277934612+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:24.277959263+08:00" level=warning msg="[TCP] dial Domestic (match RuleSet/direct) 192.168.18.71:63374 --> hpd.baidu.com:443 error: dns resolve failed: couldn't find ip" time="2023-12-30T20:12:25.278501223+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:25.278548613+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:25.278745685+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] A from udp://192.168.18.91:53" time="2023-12-30T20:12:25.278771945+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:25.278795625+08:00" level=warning msg="[TCP] dial Domestic (match RuleSet/direct) 192.168.18.71:63374 --> hpd.baidu.com:443 error: dns resolve failed: couldn't find ip" time="2023-12-30T20:12:26.279110503+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:26.279172394+08:00" level=debug msg="[DNS] resolve hpd.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:26.279389385+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:26.279421146+08:00" level=debug msg="[DNS] hpd.baidu.com --> [] A from udp://192.168.18.91:53" time="2023-12-30T20:12:26.279461346+08:00" level=warning msg="[TCP] dial Domestic (match RuleSet/direct) 192.168.18.71:63374 --> hpd.baidu.com:443 error: dns resolve failed: couldn't find ip" time="2023-12-30T20:12:27.366046973+08:00" level=debug msg="[Rule] use default rules" time="2023-12-30T20:12:27.366101284+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-30 20:12:07" time="2023-12-30T20:12:27.366138644+08:00" level=debug msg="[DNS] resolve m.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:27.366111344+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-30 20:12:07" time="2023-12-30T20:12:27.366217504+08:00" level=debug msg="[DNS] resolve m.baidu.com from udp://192.168.18.91:53" time="2023-12-30T20:12:27.366385096+08:00" level=debug msg="[DNS] m.baidu.com --> [2408:871a:2100:5:0:ff:b0bd:8bf 2408:871a:2100:4:0:ff:b06a:567f] AAAA from udp://192.168.18.91:53" time="2023-12-30T20:12:27.366419456+08:00" level=debug msg="[DNS] m.baidu.com --> [110.242.68.10 110.242.68.9] A from udp://192.168.18.91:53" time="2023-12-30T20:12:27.375952793+08:00" level=info msg="[TCP] 192.168.18.71:63375 --> m.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-30T20:12:32.962784083+08:00" level=debug msg="[Rule] use default rules" ```
关闭mihomo 内置dns ### 关闭mihomo 内置dns ```time="2023-12-30T20:00:15.153682638+08:00" level=warning msg="[TCP] dial Domestic (match RuleSet/direct) 192.168.18.71:63271 --> hpd.baidu.com:443 error: dns resolve failed: lookup hpd.baidu.com on 192.168.18.91:53: no such host" '''''' time="2023-12-30T20:00:17.581740043+08:00" level=warning msg="[TCP] dial Domestic (match RuleSet/direct) 192.168.18.71:63271 --> hpd.baidu.com:443 error: dns resolve failed: lookup hpd.baidu.com on 192.168.18.91:53: no such host" time="2023-12-30T20:00:18.680613418+08:00" level=debug msg="[Rule] use default rules" time="2023-12-30T20:00:18.690132633+08:00" level=info msg="[TCP] 192.168.18.71:63272 --> m.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" ```
nslookup ### nslookup hpd.baidu.com ```nslookup hpd.baidu.com Server: 192.168.18.91 Address: 192.168.18.91:53 ** server can't find hpd.baidu.com: NXDOMAIN ** server can't find hpd.baidu.com: NXDOMAIN ```
原版clas核心 连接一次www.baidu.com的日志 中间省略 20:08:03开始20:08:04结束 ``` 20:08:03 DBG [TCP] accept connection lAddr=192.168.18.71:63333 rAddr=www.baidu.com:443 inbound=HTTP Connect 20:08:03 DBG [Matcher] resolve success host=www.baidu.com ip=110.242.68.4 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=AAAA name=www.baidu.com. answer=["2408:871a:2100:2:0:ff:b09f:237","2408:871a:2100:3:0:ff:b025:348d"] 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=A name=www.baidu.com. answer=["110.242.68.4","110.242.68.3"] 20:08:03 INF [TCP] connected lAddr=192.168.18.71:63333 rAddr=www.baidu.com:443 mode=rule rule=RuleSet(direct) proxy=Domestic[DIRECT] 20:08:03 DBG [TCP] accept connection lAddr=192.168.18.71:63334 rAddr=f7.baidu.com:443 inbound=HTTP Connect 20:08:03 DBG [Matcher] resolve success host=f7.baidu.com ip=123.235.30.36 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=AAAA name=f7.baidu.com. answer=["2408:8719:401:fffe::7b81:ea24"] 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=A name=f7.baidu.com. answer=["119.167.210.36"] 20:08:03 DBG [TCP] accept connection lAddr=192.168.18.71:63335 rAddr=hpd.baidu.com:443 inbound=HTTP Connect 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=A name=hpd.baidu.com. answer=[] 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=AAAA name=hpd.baidu.com. answer=[] 20:08:03 DBG [DNS] response empty request={"Id":63262,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":1,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:03 DBG [DNS] response empty request={"Id":23844,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":28,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:03 DBG [Matcher] resolve failed error=couldn't find ip: hpd.baidu.com host=hpd.baidu.com 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=AAAA name=hpd.baidu.com. answer=[] 20:08:03 DBG [DNS] response empty request={"Id":26460,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":28,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=A name=hpd.baidu.com. answer=[] 20:08:03 DBG [DNS] response empty request={"Id":45188,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":1,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:03 WRN [TCP] dial failed error=couldn't find ip: hpd.baidu.com proxy=Domestic lAddr=192.168.18.71:63335 rAddr=hpd.baidu.com:443 rule=RuleSet rulePayload=direct 20:08:03 DBG [TCP] accept connection lAddr=192.168.18.71:63336 rAddr=hectorstatic.baidu.com:443 inbound=HTTP Connect 20:08:03 DBG [Matcher] resolve success host=hectorstatic.baidu.com ip=112.240.58.38 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=AAAA name=hectorstatic.baidu.com. answer=["2408:8719:5300:9::70f0:3a26"] 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=A name=hectorstatic.baidu.com. answer=["112.240.58.38"] 20:08:03 DBG [TCP] accept connection lAddr=192.168.18.71:63337 rAddr=hpd.baidu.com:443 inbound=HTTP Connect 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=A name=hpd.baidu.com. answer=[] 20:08:03 DBG [DNS] response empty request={"Id":23063,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":1,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=AAAA name=hpd.baidu.com. answer=[] 20:08:03 DBG [DNS] response empty request={"Id":26918,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":28,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:03 DBG [Matcher] resolve failed error=couldn't find ip: hpd.baidu.com host=hpd.baidu.com 20:08:03 DBG [DNS] dns response source=192.168.18.91:53 qType=A name=hpd.baidu.com. answer=[] 20:08:03 DBG [DNS] response empty request={"Id":27276,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":1,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} '''''''' 20:08:04 DBG [DNS] dns response source=192.168.18.91:53 qType=AAAA name=hpd.baidu.com. answer=[] 20:08:04 DBG [DNS] response empty request={"Id":21722,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":28,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:04 WRN [TCP] dial failed error=couldn't find ip: hpd.baidu.com proxy=Domestic lAddr=192.168.18.71:63351 rAddr=hpd.baidu.com:443 rule=RuleSet rulePayload=direct 20:08:04 DBG [TCP] accept connection lAddr=192.168.18.71:63352 rAddr=hpd.baidu.com:443 inbound=HTTP Connect 20:08:04 DBG [DNS] dns response source=192.168.18.91:53 qType=AAAA name=hpd.baidu.com. answer=[] 20:08:04 DBG [DNS] dns response source=192.168.18.91:53 qType=A name=hpd.baidu.com. answer=[] 20:08:04 DBG [DNS] response empty request={"Id":14974,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":1,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:04 DBG [DNS] response empty request={"Id":9147,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":28,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:04 DBG [Matcher] resolve failed error=couldn't find ip: hpd.baidu.com host=hpd.baidu.com 20:08:04 DBG [DNS] dns response source=192.168.18.91:53 qType=AAAA name=hpd.baidu.com. answer=[] 20:08:04 DBG [DNS] response empty request={"Id":12620,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":28,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:04 DBG [DNS] dns response source=192.168.18.91:53 qType=A name=hpd.baidu.com. answer=[] 20:08:04 DBG [DNS] response empty request={"Id":21560,"Response":true,"Opcode":0,"Authoritative":false,"Truncated":false,"RecursionDesired":true,"RecursionAvailable":true,"Zero":false,"AuthenticatedData":false,"CheckingDisabled":false,"Rcode":3,"Question":[{"Name":"hpd.baidu.com.","Qtype":1,"Qclass":1}],"Answer":null,"Ns":null,"Extra":null,"Source":"192.168.18.91:53"} 20:08:04 WRN [TCP] dial failed error=couldn't find ip: hpd.baidu.com proxy=Domestic lAddr=192.168.18.71:63352 rAddr=hpd.baidu.com:443 rule=RuleSet rulePayload=direct ```
naa-nac commented 8 months ago

再次测试发现 上游dns不设置拦截域名 mihomo无规则 上游dns不设置拦截域名 mihomo设置广告域名拦截规则 上游dns设置拦截域名 mihomo设置广告域名拦截规则 这三种种情况 网页体感都是不到1秒加载完毕 其他表现也都正常

只有上游dns设置拦截域名 mihomo无规则这种情况 日志显示会在20多秒的时间里一直尝试连接拦截域名 ios浏览器进度条停在中间 直至 20多秒后 网页加载完毕

上游dns不拦截域名 mihomo无规则 ``` time="2023-12-31T16:36:01.396261335+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:01.396315125+08:00" level=debug msg="[DNS] cache hit for www.baidu.com., expire at 2023-12-31 16:36:10" time="2023-12-31T16:36:01.396337235+08:00" level=debug msg="[DNS] cache hit for www.baidu.com., expire at 2023-12-31 16:35:26" time="2023-12-31T16:36:01.396434766+08:00" level=debug msg="[DNS] resolve www.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.396702278+08:00" level=debug msg="[DNS] www.baidu.com --> [2408:871a:2100:2:0:ff:b09f:237 2408:871a:2100:3:0:ff:b025:348d] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.405312198+08:00" level=info msg="[TCP] 192.168.18.71:55732 --> www.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:01.775107372+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:01.775160012+08:00" level=debug msg="[DNS] cache hit for hm.baidu.com., expire at 2023-12-31 16:35:27" time="2023-12-31T16:36:01.775204972+08:00" level=debug msg="[DNS] cache hit for hm.baidu.com., expire at 2023-12-31 16:35:47" time="2023-12-31T16:36:01.775215503+08:00" level=debug msg="[DNS] resolve hm.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.775232613+08:00" level=debug msg="[DNS] resolve hm.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.775445964+08:00" level=debug msg="[DNS] hm.baidu.com --> [2408:80f0:410b:2ae:0:ff:b089:569d] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.775473084+08:00" level=debug msg="[DNS] hm.baidu.com --> [111.206.209.249] A from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.78056131+08:00" level=info msg="[TCP] 192.168.18.71:55733 --> hm.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:01.796895586+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:01.796938066+08:00" level=debug msg="[DNS] cache hit for t10.baidu.com., expire at 2023-12-31 16:35:49" time="2023-12-31T16:36:01.796962446+08:00" level=debug msg="[DNS] cache hit for t10.baidu.com., expire at 2023-12-31 16:35:53" time="2023-12-31T16:36:01.796979816+08:00" level=debug msg="[DNS] resolve t10.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.797005946+08:00" level=debug msg="[DNS] resolve t10.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.797159187+08:00" level=debug msg="[DNS] t10.baidu.com --> [119.249.50.36] A from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.797179358+08:00" level=debug msg="[DNS] t10.baidu.com --> [2408:8722:5800:2::3da3:3324 2408:8726:7000::3cdd:1224 2408:8752:100:d::7727:cb24 2408:871a:b800:11::7916:ef24 2408:8719:3000:b::1bdd:2624 2408:8719:3100:3::77a7:fe24 2408:8719:3100:4::7beb:1e24 2408:871a:5100:101::6548:c724 2408:871a:5100:200::6548:cb24 2408:8630:20c0:6::2a3b:1124] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.799790616+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:01.799821786+08:00" level=debug msg="[DNS] cache hit for hpd.baidu.com., expire at 2023-12-31 16:36:10" time="2023-12-31T16:36:01.799838456+08:00" level=debug msg="[DNS] cache hit for hpd.baidu.com., expire at 2023-12-31 16:37:28" time="2023-12-31T16:36:01.801200626+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:01.801266416+08:00" level=debug msg="[DNS] cache hit for hectorstatic.baidu.com., expire at 2023-12-31 16:35:26" time="2023-12-31T16:36:01.801276806+08:00" level=debug msg="[DNS] cache hit for hectorstatic.baidu.com., expire at 2023-12-31 16:35:22" time="2023-12-31T16:36:01.801308207+08:00" level=debug msg="[DNS] resolve hectorstatic.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.801330627+08:00" level=debug msg="[DNS] resolve hectorstatic.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.801484748+08:00" level=debug msg="[DNS] hectorstatic.baidu.com --> [2408:8719:5300:9::70f0:3a26] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.801504858+08:00" level=debug msg="[DNS] hectorstatic.baidu.com --> [112.240.58.38] A from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.804237907+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:01.804284398+08:00" level=debug msg="[DNS] resolve b.bdstatic.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.804329008+08:00" level=debug msg="[DNS] resolve b.bdstatic.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.804452979+08:00" level=info msg="[TCP] 192.168.18.71:55735 --> hpd.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:01.804484969+08:00" level=debug msg="[DNS] b.bdstatic.com --> [221.195.34.48] A from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.804503599+08:00" level=debug msg="[DNS] b.bdstatic.com --> [2408:8719:3100:4::7beb:1e30] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.806568874+08:00" level=info msg="[TCP] 192.168.18.71:55734 --> t10.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:01.809165712+08:00" level=info msg="[TCP] 192.168.18.71:55737 --> b.bdstatic.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:01.813841715+08:00" level=info msg="[TCP] 192.168.18.71:55736 --> hectorstatic.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:01.988759971+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:01.988796612+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-31 16:35:26" time="2023-12-31T16:36:01.988821442+08:00" level=debug msg="[DNS] resolve m.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.988837512+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-31 16:35:55" time="2023-12-31T16:36:01.988872382+08:00" level=debug msg="[DNS] resolve m.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.989019183+08:00" level=debug msg="[DNS] m.baidu.com --> [110.242.68.10 110.242.68.9] A from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.989038383+08:00" level=debug msg="[DNS] m.baidu.com --> [2408:871a:2100:5:0:ff:b0bd:8bf 2408:871a:2100:4:0:ff:b06a:567f] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:36:01.996740778+08:00" level=info msg="[TCP] 192.168.18.71:55738 --> m.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:02.004287231+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:02.004324101+08:00" level=debug msg="[DNS] cache hit for feed.baidu.com., expire at 2023-12-31 16:36:17" time="2023-12-31T16:36:02.004328161+08:00" level=debug msg="[DNS] cache hit for feed.baidu.com., expire at 2023-12-31 16:36:23" time="2023-12-31T16:36:02.039962094+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:02.040001444+08:00" level=debug msg="[DNS] cache hit for hm.baidu.com., expire at 2023-12-31 16:36:06" time="2023-12-31T16:36:02.040001664+08:00" level=debug msg="[DNS] cache hit for hm.baidu.com., expire at 2023-12-31 16:36:06" time="2023-12-31T16:36:02.871708242+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:02.871762382+08:00" level=debug msg="[DNS] cache hit for h2tcbox.baidu.com., expire at 2023-12-31 16:36:54" time="2023-12-31T16:36:02.871783922+08:00" level=debug msg="[DNS] cache hit for h2tcbox.baidu.com., expire at 2023-12-31 16:35:28" time="2023-12-31T16:36:02.871828352+08:00" level=debug msg="[DNS] resolve h2tcbox.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:36:02.872058534+08:00" level=debug msg="[DNS] h2tcbox.baidu.com --> [2408:80f0:410b:167:0:ff:b0e0:aa3d] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:36:02.876765077+08:00" level=info msg="[TCP] 192.168.18.71:55741 --> h2tcbox.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:03.021947274+08:00" level=info msg="[TCP] 192.168.18.71:55739 --> feed.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:03.049895701+08:00" level=info msg="[TCP] 192.168.18.71:55740 --> hm.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:03.132427544+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:03.132493555+08:00" level=debug msg="[DNS] cache hit for hm.baidu.com., expire at 2023-12-31 16:36:06" time="2023-12-31T16:36:03.132494005+08:00" level=debug msg="[DNS] cache hit for hm.baidu.com., expire at 2023-12-31 16:36:06" time="2023-12-31T16:36:03.137614831+08:00" level=info msg="[TCP] 192.168.18.71:55742 --> hm.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:36:03.197568525+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:36:03.197608615+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-31 16:36:06" time="2023-12-31T16:36:03.197624305+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-31 16:36:06" time="2023-12-31T16:36:03.205929244+08:00" level=info msg="[TCP] 192.168.18.71:55743 --> m.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" ```
上游dns不拦截域名 mihomo设置广告域名拦截规则 ``` time="2023-12-31T16:39:03.917301831+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:03.917369301+08:00" level=debug msg="[DNS] cache hit for www.baidu.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:03.917405182+08:00" level=debug msg="[DNS] resolve www.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:03.917369681+08:00" level=debug msg="[DNS] cache hit for www.baidu.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:03.917541023+08:00" level=debug msg="[DNS] resolve www.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:03.917645563+08:00" level=debug msg="[DNS] www.baidu.com --> [2408:871a:2100:3:0:ff:b025:348d 2408:871a:2100:2:0:ff:b09f:237] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:39:03.917703664+08:00" level=debug msg="[DNS] www.baidu.com --> [110.242.68.3 110.242.68.4] A from udp://192.168.18.91:1053" time="2023-12-31T16:39:03.926126643+08:00" level=info msg="[TCP] 192.168.18.71:55766 --> www.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:39:04.381417295+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.381484616+08:00" level=debug msg="[DNS] cache hit for t10.baidu.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:04.381486536+08:00" level=debug msg="[DNS] cache hit for t10.baidu.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:04.381517156+08:00" level=debug msg="[DNS] resolve t10.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.381595576+08:00" level=debug msg="[DNS] resolve t10.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.381744767+08:00" level=debug msg="[DNS] t10.baidu.com --> [119.249.50.36] A from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.381802888+08:00" level=debug msg="[DNS] t10.baidu.com --> [2408:8719:6c00:103::77b0:1924 2408:870c:1040:1::d35f:2224 2408:8719:64:9a::275b:b624 2408:8719:2000:4::77a7:d224 2408:8719:2100:1::77a7:8b24 2408:8719:6c00:102::77b0:1824 2408:8634:5700:a::af15:fa24 2408:871a:5100:200::6548:cb24 2408:8719:3100:3::77a7:fe24 2408:8722:5800:2::3da3:3324] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.383008846+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.383037587+08:00" level=info msg="[TCP] 192.168.18.71:55768 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:04.384691378+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.384726478+08:00" level=debug msg="[DNS] cache hit for hectorstatic.baidu.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:04.384755369+08:00" level=debug msg="[DNS] resolve hectorstatic.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.384732219+08:00" level=debug msg="[DNS] cache hit for hectorstatic.baidu.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:04.384842759+08:00" level=debug msg="[DNS] resolve hectorstatic.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.38489923+08:00" level=debug msg="[DNS] hectorstatic.baidu.com --> [2408:8719:5300:9::70f0:3a26] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.38499637+08:00" level=debug msg="[DNS] hectorstatic.baidu.com --> [112.240.58.38] A from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.387497568+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.387559058+08:00" level=debug msg="[DNS] cache hit for b.bdstatic.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:04.387567399+08:00" level=debug msg="[DNS] cache hit for b.bdstatic.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:04.387604489+08:00" level=debug msg="[DNS] resolve b.bdstatic.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.387642649+08:00" level=debug msg="[DNS] resolve b.bdstatic.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.38776769+08:00" level=debug msg="[DNS] b.bdstatic.com --> [221.195.34.48] A from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.38778894+08:00" level=debug msg="[DNS] b.bdstatic.com --> [2408:8719:3100:4::7beb:1e30] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.390721202+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.390743102+08:00" level=info msg="[TCP] 192.168.18.71:55771 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:04.391603358+08:00" level=info msg="[TCP] 192.168.18.71:55770 --> b.bdstatic.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:39:04.391635338+08:00" level=info msg="[TCP] 192.168.18.71:55767 --> t10.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:39:04.397289628+08:00" level=info msg="[TCP] 192.168.18.71:55769 --> hectorstatic.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:39:04.401015604+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.401047325+08:00" level=info msg="[TCP] 192.168.18.71:55772 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:04.52756536+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.52760401+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:04.52762705+08:00" level=debug msg="[DNS] resolve m.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.52762859+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-31 16:38:09" time="2023-12-31T16:39:04.527693601+08:00" level=debug msg="[DNS] resolve m.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.527805102+08:00" level=debug msg="[DNS] m.baidu.com --> [110.242.68.10 110.242.68.9] A from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.527851772+08:00" level=debug msg="[DNS] m.baidu.com --> [2408:871a:2100:5:0:ff:b0bd:8bf 2408:871a:2100:4:0:ff:b06a:567f] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:39:04.536159361+08:00" level=info msg="[TCP] 192.168.18.71:55773 --> m.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:39:04.539228402+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.539251142+08:00" level=info msg="[TCP] 192.168.18.71:55774 --> feed.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:04.545579917+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.545601027+08:00" level=info msg="[TCP] 192.168.18.71:55775 --> feed.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:04.567471662+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.567494012+08:00" level=info msg="[TCP] 192.168.18.71:55776 --> hm.baidu.com:443 match RuleSet(reject) using REJECT" time="2023-12-31T16:39:04.574350851+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.574368591+08:00" level=info msg="[TCP] 192.168.18.71:55777 --> hm.baidu.com:443 match RuleSet(reject) using REJECT" time="2023-12-31T16:39:04.585135827+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.585160817+08:00" level=info msg="[TCP] 192.168.18.71:55778 --> hm.baidu.com:443 match RuleSet(reject) using REJECT" time="2023-12-31T16:39:04.605604912+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.605629072+08:00" level=info msg="[TCP] 192.168.18.71:55779 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:04.613612958+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.613633838+08:00" level=info msg="[TCP] 192.168.18.71:55780 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:04.621332373+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.621356254+08:00" level=info msg="[TCP] 192.168.18.71:55781 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:04.670608952+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:04.670648802+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-31 16:39:26" time="2023-12-31T16:39:04.670660553+08:00" level=debug msg="[DNS] cache hit for m.baidu.com., expire at 2023-12-31 16:39:09" time="2023-12-31T16:39:04.679528915+08:00" level=info msg="[TCP] 192.168.18.71:55782 --> m.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:39:05.412501213+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:05.412545784+08:00" level=info msg="[TCP] 192.168.18.71:55783 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:05.414126755+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:05.414175005+08:00" level=debug msg="[DNS] cache hit for h2tcbox.baidu.com., expire at 2023-12-31 16:38:10" time="2023-12-31T16:39:05.414202915+08:00" level=debug msg="[DNS] cache hit for h2tcbox.baidu.com., expire at 2023-12-31 16:38:10" time="2023-12-31T16:39:05.414207875+08:00" level=debug msg="[DNS] resolve h2tcbox.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:05.414251016+08:00" level=debug msg="[DNS] resolve h2tcbox.baidu.com from udp://192.168.18.91:1053" time="2023-12-31T16:39:05.414456497+08:00" level=debug msg="[DNS] h2tcbox.baidu.com --> [111.206.210.42] A from udp://192.168.18.91:1053" time="2023-12-31T16:39:05.414483017+08:00" level=debug msg="[DNS] h2tcbox.baidu.com --> [2408:80f0:410b:167:0:ff:b0e0:aa3d] AAAA from udp://192.168.18.91:1053" time="2023-12-31T16:39:05.4205512+08:00" level=info msg="[TCP] 192.168.18.71:55784 --> h2tcbox.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:39:05.424476978+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:05.424512808+08:00" level=info msg="[TCP] 192.168.18.71:55785 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:39:05.433376321+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:39:05.433403312+08:00" level=info msg="[TCP] 192.168.18.71:55786 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" ```
上游dns拦截域名 mihomo设置广告域名拦截规则 ``` time="2023-12-31T16:41:01.982915698+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:01.982990289+08:00" level=debug msg="[DNS] resolve www.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:01.983028809+08:00" level=debug msg="[DNS] resolve www.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:01.98325131+08:00" level=debug msg="[DNS] www.baidu.com --> [110.242.68.3 110.242.68.4] A from udp://192.168.18.91:53" time="2023-12-31T16:41:01.983288851+08:00" level=debug msg="[DNS] www.baidu.com --> [2408:871a:2100:3:0:ff:b025:348d 2408:871a:2100:2:0:ff:b09f:237] AAAA from udp://192.168.18.91:53" time="2023-12-31T16:41:01.992410805+08:00" level=info msg="[TCP] 192.168.18.71:55790 --> www.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:41:02.309141418+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.309215119+08:00" level=debug msg="[DNS] resolve t12.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.309248239+08:00" level=debug msg="[DNS] resolve t12.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.30944247+08:00" level=debug msg="[DNS] t12.baidu.com --> [119.249.50.36] A from udp://192.168.18.91:53" time="2023-12-31T16:41:02.30946318+08:00" level=debug msg="[DNS] t12.baidu.com --> [2408:8719:5f01:d::3da2:ac24 2408:8726:7000::3cdd:1224 2408:8719:3100:4::7beb:1e24 2408:871a:b800:11::7916:ef24 2408:8752:100:d::7727:cb24 2408:8710:1020:1::da44:8824 2408:8719:401:fffe::7b81:ea24 2408:8719:5f01::7b82:7b24 2408:8630:20c0:6::2a3b:1124 2408:871a:5100:101::6548:c724] AAAA from udp://192.168.18.91:53" time="2023-12-31T16:41:02.311004191+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.311084732+08:00" level=debug msg="[DNS] resolve t11.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.311131032+08:00" level=debug msg="[DNS] resolve t11.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.311301493+08:00" level=debug msg="[DNS] t11.baidu.com --> [119.249.50.36] A from udp://192.168.18.91:53" time="2023-12-31T16:41:02.311321633+08:00" level=debug msg="[DNS] t11.baidu.com --> [2408:870c:1040:1::d35f:2224 2408:8719:64:9a::275b:b624 2408:8719:2000:4::77a7:d224 2408:8719:2100:1::77a7:8b24 2408:8719:6c00:102::77b0:1824 2408:8719:6c00:103::77b0:1924 2408:8726:1001:100::ddcc:3124 2408:872b:d80:2::7472:6224 2408:8736:1002::7a8f:824 2408:8634:5700:a::af15:fa24] AAAA from udp://192.168.18.91:53" time="2023-12-31T16:41:02.314001862+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.314043023+08:00" level=info msg="[TCP] 192.168.18.71:55793 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:02.317763509+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.317818379+08:00" level=debug msg="[DNS] resolve hectorstatic.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.31785237+08:00" level=debug msg="[DNS] resolve hectorstatic.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.318014781+08:00" level=debug msg="[DNS] hectorstatic.baidu.com --> [2408:8719:5300:9::70f0:3a26] AAAA from udp://192.168.18.91:53" time="2023-12-31T16:41:02.318062021+08:00" level=debug msg="[DNS] hectorstatic.baidu.com --> [112.240.58.38] A from udp://192.168.18.91:53" time="2023-12-31T16:41:02.31935865+08:00" level=info msg="[TCP] 192.168.18.71:55791 --> t12.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:41:02.320099325+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.320149856+08:00" level=debug msg="[DNS] resolve b.bdstatic.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.320174896+08:00" level=debug msg="[DNS] resolve b.bdstatic.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.320326897+08:00" level=debug msg="[DNS] b.bdstatic.com --> [2408:8719:3100:4::7beb:1e30] AAAA from udp://192.168.18.91:53" time="2023-12-31T16:41:02.320346767+08:00" level=debug msg="[DNS] b.bdstatic.com --> [221.195.34.48] A from udp://192.168.18.91:53" time="2023-12-31T16:41:02.321707387+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.321726917+08:00" level=info msg="[TCP] 192.168.18.71:55792 --> t11.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:41:02.321737097+08:00" level=info msg="[TCP] 192.168.18.71:55796 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:02.324331355+08:00" level=info msg="[TCP] 192.168.18.71:55795 --> b.bdstatic.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:41:02.330201588+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.330231158+08:00" level=info msg="[TCP] 192.168.18.71:55797 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:02.334325297+08:00" level=info msg="[TCP] 192.168.18.71:55794 --> hectorstatic.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:41:02.52256032+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.52264161+08:00" level=debug msg="[DNS] resolve m.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.522700181+08:00" level=debug msg="[DNS] resolve m.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.522821961+08:00" level=debug msg="[DNS] m.baidu.com --> [110.242.68.10 110.242.68.9] A from udp://192.168.18.91:53" time="2023-12-31T16:41:02.522908292+08:00" level=debug msg="[DNS] m.baidu.com --> [2408:871a:2100:5:0:ff:b0bd:8bf 2408:871a:2100:4:0:ff:b06a:567f] AAAA from udp://192.168.18.91:53" time="2023-12-31T16:41:02.532286888+08:00" level=info msg="[TCP] 192.168.18.71:55798 --> m.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:41:02.547456016+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.547487626+08:00" level=info msg="[TCP] 192.168.18.71:55799 --> feed.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:02.553856281+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.553880732+08:00" level=info msg="[TCP] 192.168.18.71:55800 --> feed.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:02.559579212+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.559606132+08:00" level=info msg="[TCP] 192.168.18.71:55801 --> feed.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:02.596608504+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.596661484+08:00" level=debug msg="[DNS] resolve www.qq.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.596702545+08:00" level=debug msg="[DNS] resolve www.qq.com from udp://192.168.18.91:53" time="2023-12-31T16:41:02.597130128+08:00" level=debug msg="[DNS] www.qq.com --> [221.198.70.47] A from udp://192.168.18.91:53" time="2023-12-31T16:41:02.612698428+08:00" level=debug msg="[DNS] www.qq.com --> [2408:8711:10:1003::30 2408:8711:10:1002::19] AAAA from udp://192.168.18.91:53" time="2023-12-31T16:41:02.617595462+08:00" level=info msg="[TCP] 192.168.18.71:55802 --> www.qq.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:41:02.647921257+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.647966567+08:00" level=info msg="[TCP] 192.168.18.71:55803 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:02.654958017+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.655000267+08:00" level=info msg="[TCP] 192.168.18.71:55804 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:02.660791589+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:02.660818629+08:00" level=info msg="[TCP] 192.168.18.71:55805 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:03.441259987+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:03.441304477+08:00" level=info msg="[TCP] 192.168.18.71:55806 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:03.44872725+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:03.4487693+08:00" level=info msg="[TCP] 192.168.18.71:55807 --> hm.baidu.com:443 match RuleSet(reject) using REJECT" time="2023-12-31T16:41:03.455014174+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:03.455043174+08:00" level=info msg="[TCP] 192.168.18.71:55808 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:03.461331099+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:03.461393209+08:00" level=debug msg="[DNS] resolve h2tcbox.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:03.461433279+08:00" level=debug msg="[DNS] resolve h2tcbox.baidu.com from udp://192.168.18.91:53" time="2023-12-31T16:41:03.461621311+08:00" level=debug msg="[DNS] h2tcbox.baidu.com --> [2408:80f0:410b:167:0:ff:b0e0:aa3d] AAAA from udp://192.168.18.91:53" time="2023-12-31T16:41:03.461634201+08:00" level=debug msg="[DNS] h2tcbox.baidu.com --> [111.206.210.42] A from udp://192.168.18.91:53" time="2023-12-31T16:41:03.462657868+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:03.462686338+08:00" level=info msg="[TCP] 192.168.18.71:55810 --> hpd.baidu.com:443 match RuleSet(AntiAd) using REJECT" time="2023-12-31T16:41:03.467325782+08:00" level=info msg="[TCP] 192.168.18.71:55809 --> h2tcbox.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" time="2023-12-31T16:41:03.484679624+08:00" level=debug msg="[Rule] use default rules" time="2023-12-31T16:41:03.484720745+08:00" level=debug msg="[DNS] cache hit for h2tcbox.baidu.com., expire at 2023-12-31 16:41:08" time="2023-12-31T16:41:03.484732445+08:00" level=debug msg="[DNS] cache hit for h2tcbox.baidu.com., expire at 2023-12-31 16:41:36" time="2023-12-31T16:41:03.490458005+08:00" level=info msg="[TCP] 192.168.18.71:55811 --> h2tcbox.baidu.com:443 match RuleSet(direct) using Domestic[DIRECT]" ```
sleepm commented 8 months ago

这不是 bug,是你规则没写好 上游拦截返回 255.255.255.0 mihomoe 规则加一个

naa-nac commented 8 months ago

可能还是我哪里的设置问题 但加了这规则好像也没起作用

测试了对拦截域名返回 reject 0 或 reject 3 在dns设置拦截 mihomo不设置拦截规则 都出现了那种情况 然后mihomo再设置 IP-CIDR,255.255.255.0/32,REJECT 这条拦截规则 也是一样

上游dns使用的是mosdns

dns log ### reject 3 ``` 2024-01-02T20:06:14.264+0800 INFO main_sequence.r7 debugreject {"query": ";; opcode: QUERY, status: NOERROR, id: 47741\n;; flags: rd ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1\n\n;; OPT PSEUDOSECTION:\n; EDNS: version 0; flags:; udp: 1200\n\n;; QUESTION SECTION:\n;hm.baidu.com.\tIN\t A\n"} 2024-01-02T20:06:14.264+0800 INFO main_sequence.r6 reject {"uqid": 8, "client": "192.168.18.91", "qname": "hm.baidu.com.", "qtype": 1, "qclass": 1, "rcode": 3, "elapsed": "72.85µs"} 2024-01-02T20:06:14.264+0800 INFO main_sequence.r7 debugreject {"query": ";; opcode: QUERY, status: NOERROR, id: 48011\n;; flags: rd ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1\n\n;; OPT PSEUDOSECTION:\n; EDNS: version 0; flags:; udp: 1200\n\n;; QUESTION SECTION:\n;hm.baidu.com.\tIN\t AAAA\n"} 2024-01-02T20:06:14.264+0800 INFO main_sequence.r6 reject {"uqid": 7, "client": "192.168.18.91", "qname": "hm.baidu.com.", "qtype": 28, "qclass": 1, "rcode": 3, "elapsed": "119.561µs"} ```
dns log2 ### reject 0 ``` 2024-01-02T20:47:45.654+0800 INFO main_sequence.r7 debugreject {"query": ";; opcode: QUERY, status: NOERROR, id: 53164\n;; flags: rd ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1\n\n;; OPT PSEUDOSECTION:\n; EDNS: version 0; flags:; udp: 1200\n\n;; QUESTION SECTION:\n;hm.baidu.com.\tIN\t AAAA\n"} 2024-01-02T20:47:45.654+0800 INFO main_sequence.r6 reject {"uqid": 1, "client": "192.168.18.91", "qname": "hm.baidu.com.", "qtype": 28, "qclass": 1, "rcode": 0, "elapsed": "71.66µs"} 2024-01-02T20:47:45.654+0800 INFO main_sequence.r7 debugreject {"query": ";; opcode: QUERY, status: NOERROR, id: 52924\n;; flags: rd ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1\n\n;; OPT PSEUDOSECTION:\n; EDNS: version 0; flags:; udp: 1200\n\n;; QUESTION SECTION:\n;hm.baidu.com.\tIN\t A\n"} 2024-01-02T20:47:45.654+0800 INFO main_sequence.r6 reject {"uqid": 2, "client": "192.168.18.91", "qname": "hm.baidu.com.", "qtype": 1, "qclass": 1, "rcode": 0, "elapsed": "64.601µs"} ```

mosdns只返回了响应码

透明代理 ipv6也是相似的规则省略了 tproxy-port: 12345

iptables ``` # 设置策略路由 ip rule add fwmark 1 table 100 ip route add local 0.0.0.0/0 dev lo table 100 # 代理局域网设备 iptables -t mangle -N V2RAY iptables -t mangle -A V2RAY -d 127.0.0.1/32 -j RETURN iptables -t mangle -A V2RAY -d 192.168.0.0/16 -j RETURN iptables -t mangle -A V2RAY -d 224.0.0.0/3 -j RETURN iptables -t mangle -A V2RAY -p udp -j TPROXY --on-port 12345 --tproxy-mark 1 # 给 UDP 打标记 1,转发至 12345 端口 iptables -t mangle -A V2RAY -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1 # 给 TCP 打标记 1,转发至 12345 端口 iptables -t mangle -A PREROUTING -j V2RAY # 应用规则 ```

在这里255.255.255.0直连了本机 我也试了一下删掉这句iptables -t mangle -A V2RAY -d 224.0.0.0/3 -j RETURN 还是这情况

Skyxim commented 8 months ago

返回 0000 作为拦截可以临时解决此问题

wwqgtxx commented 8 months ago

fixed in https://github.com/MetaCubeX/mihomo/commit/2e12ceeaed5124129bb1a71993a243524044f93f

naa-nac commented 8 months ago

测试了一下 这样就没问题了 谢谢