morytyann / OpenWrt-mihomo

Transparent Proxy with Mihomo on OpenWrt.
MIT License
1.23k stars 142 forks source link

[BUG]发现不能按照顺序匹配策略 #214

Closed lynn5713 closed 1 month ago

lynn5713 commented 1 month ago

自查

确认

系统

ImmortalWrt

系统版本

23.05

插件版本

1.8.4-1

硬件架构

aarch64_cortex-a53

BUG 描述

copilot跟Microsoft的域名有部分重合,我尝试把copilot的策略调整在Microsoft的上面,但是还是匹配到Microsoft规则,导致分流异常

预期行为

www.bing.com 从策略上看应该先匹配到copilot,但是匹配到Microsoft。

复现步骤

常见现象

插件配置

root@ImmortalWrt:~# uci show mihomo mihomo.status=status mihomo.config=config mihomo.config.enabled='1' mihomo.config.scheduled_restart='0' mihomo.config.cron_expression='0 3 *' mihomo.config.profile='file:paofu_mihomo-old.yaml' mihomo.config.mixin='1' mihomo.config.test_profile='1' mihomo.config.upload_profile='/etc/mihomo/profiles/paofu_mihomo-old.yaml' mihomo.config.fast_reload='1' mihomo.proxy=proxy mihomo.proxy.transparent_proxy='1' mihomo.proxy.tcp_transparent_proxy_mode='tproxy' mihomo.proxy.udp_transparent_proxy_mode='tun' mihomo.proxy.ipv4_dns_hijack='1' mihomo.proxy.ipv6_dns_hijack='1' mihomo.proxy.ipv4_proxy='1' mihomo.proxy.ipv6_proxy='0' mihomo.proxy.router_proxy='1' mihomo.proxy.lan_proxy='1' mihomo.proxy.access_control_mode='all' mihomo.proxy.bypass_china_mainland_ip='1' mihomo.proxy.acl_tcp_dport='0-65535' mihomo.proxy.acl_udp_dport='0-65535' mihomo.subscription=subscription mihomo.subscription.name='default' mihomo.subscription.url='http://example.com/default.yaml' mihomo.subscription.user_agent='clash' mihomo.mixin=mixin mihomo.mixin.log_level='warning' mihomo.mixin.mode='rule' mihomo.mixin.match_process='off' mihomo.mixin.ipv6='0' mihomo.mixin.tcp_keep_alive_idle='600' mihomo.mixin.tcp_keep_alive_interval='15' mihomo.mixin.ui_name='metacubexd' mihomo.mixin.ui_url='https://mirror.ghproxy.com/https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip' mihomo.mixin.api_port='9090' mihomo.mixin.selection_cache='1' mihomo.mixin.allow_lan='1' mihomo.mixin.http_port='8080' mihomo.mixin.socks_port='1080' mihomo.mixin.mixed_port='7890' mihomo.mixin.redir_port='7891' mihomo.mixin.tproxy_port='7892' mihomo.mixin.authentication='1' mihomo.mixin.tun_stack='mixed' mihomo.mixin.tun_mtu='9000' mihomo.mixin.tun_gso='0' mihomo.mixin.tun_endpoint_independent_nat='0' mihomo.mixin.dns_port='1053' mihomo.mixin.dns_mode='redir-host' mihomo.mixin.fake_ip_range='198.18.0.1/16' mihomo.mixin.fake_ip_filter='0' mihomo.mixin.fake_ip_filters='+.lan' '+.local' mihomo.mixin.fake_ip_cache='1' mihomo.mixin.dns_respect_rules='1' mihomo.mixin.dns_doh_prefer_http3='0' mihomo.mixin.dns_ipv6='0' mihomo.mixin.dns_system_hosts='0' mihomo.mixin.dns_hosts='0' mihomo.mixin.hosts='0' mihomo.mixin.dns_nameserver='1' mihomo.mixin.dns_nameserver_policy='1' mihomo.mixin.geoip_format='dat' mihomo.mixin.geodata_loader='standard' mihomo.mixin.geosite_url='https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat' mihomo.mixin.geoip_mmdb_url='https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.metadb' mihomo.mixin.geoip_dat_url='https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat' mihomo.mixin.geoip_asn_url='https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb' mihomo.mixin.geox_auto_update='1' mihomo.mixin.geox_update_interval='100' mihomo.mixin.api_secret='25962' mihomo.@authentication[0]=authentication mihomo.@authentication[0].enabled='1' mihomo.@authentication[0].username='mihomo' mihomo.@authentication[0].password='25962' mihomo.@host[0]=host mihomo.@host[0].enabled='0' mihomo.@host[0].domain_name='localhost' mihomo.@host[0].ip='127.0.0.1' '::1' mihomo.@nameserver[0]=nameserver mihomo.@nameserver[0].enabled='1' mihomo.@nameserver[0].type='default-nameserver' mihomo.@nameserver[0].nameserver='223.5.5.5' mihomo.@nameserver[1]=nameserver mihomo.@nameserver[1].enabled='1' mihomo.@nameserver[1].type='proxy-server-nameserver' mihomo.@nameserver[1].nameserver='https://dns.alidns.com/dns-query' mihomo.@nameserver[2]=nameserver mihomo.@nameserver[2].enabled='0' mihomo.@nameserver[2].type='nameserver' mihomo.@nameserver[2].nameserver='https://dns.alidns.com/dns-query' 'https://doh.pub/dns-query' mihomo.@nameserver[3]=nameserver mihomo.@nameserver[3].enabled='0' mihomo.@nameserver[3].type='fallback' mihomo.@nameserver[3].nameserver='https://dns.cloudflare.com/dns-query' 'https://dns.google/dns-query' mihomo.@nameserver_policy[0]=nameserver_policy mihomo.@nameserver_policy[0].enabled='1' mihomo.@nameserver_policy[0].matcher='geosite:cn,private' mihomo.@nameserver_policy[0].nameserver='https://dns.alidns.com/dns-query' mihomo.@nameserver_policy[1]=nameserver_policy mihomo.@nameserver_policy[1].enabled='1' mihomo.@nameserver_policy[1].matcher='geosite:geolocation-!cn' mihomo.@nameserver_policy[1].nameserver='https://dns.cloudflare.com/dns-query' 'https://dns.google/dns-query' mihomo.editor=editor mihomo.log=log

配置文件

mihomo.txt

插件日志

[2024-10-03 04:47:43] App is enabled. [2024-10-03 04:47:43] Starting... [2024-10-03 04:47:43] Use Profile: paofu_mihomo-old.yaml [2024-10-03 04:47:43] Mixin is enabled, mixin all config. [2024-10-03 04:47:43] Profile testing... [2024-10-03 04:47:48] Profile test passed! [2024-10-03 04:47:48] Start Core [2024-10-03 04:47:48] Transparent Proxy is enabled. [2024-10-03 04:47:48] Transparent Proxy: Start. [2024-10-03 04:47:48] Transparent Proxy: IPv4 DNS Hijack is enabled, IPv4 dns request will redirect to the core. [2024-10-03 04:47:48] Transparent Proxy: IPv6 DNS Hijack is enabled, IPv6 dns request will redirect to the core. [2024-10-03 04:47:48] Transparent Proxy: IPv4 Proxy is enabled, set proxy for IPv4 traffic. [2024-10-03 04:47:48] Transparent Proxy: Bypass china mainland ip is enabled. [2024-10-03 04:47:48] Transparent Proxy: Destination TCP Port to Proxy: 0-65535. [2024-10-03 04:47:48] Transparent Proxy: Destination UDP Port to Proxy: 0-65535. [2024-10-03 04:47:48] Transparent Proxy: Router Proxy is enabled, set proxy for router. [2024-10-03 04:47:48] Transparent Proxy: Lan Proxy is enabled, set proxy for lan. [2024-10-03 04:47:48] Transparent Proxy: Access Control is using all mode, set proxy for all client. [2024-10-03 04:47:48] Start Successful!

核心日志

11 [info] [TCP] 192.168.100.245:61512 --> login.live.com:443 match RuleSet(microsoft_domain) using 🪟 Microsoft[🟢 直连]
10 [info] [TCP] 192.168.100.245:61511 --> www.bing.com:443 match RuleSet(microsoft_domain) using 🪟 Microsoft[🟢 直连]
9 [info] [TCP] 192.168.100.245:61510 --> login.live.com:443 match RuleSet(microsoft_domain) using 🪟 Microsoft[🟢 直连]

附加信息

morytyann commented 1 month ago

你的Copilot规则的behavior错了,明明是classical,你给它一个domain。哎……

规则仓库的README里都写了,是真不看啊。

lynn5713 commented 1 month ago

你的Copilot规则的behavior错了,明明是classical,你给它一个domain。哎……

规则仓库的README里都写了,是真不看啊。

大佬,。。。。。。好的