morytyann / OpenWrt-mihomo

Transparent Proxy with Mihomo on OpenWrt.
MIT License
1.21k stars 140 forks source link

[BUG] 开启 `遵循分流规则` 后不能启动 #168

Closed SharerMax closed 1 month ago

SharerMax commented 1 month ago

自查步骤

确认

系统

OpenWrt

系统版本

23.05.3

插件版本

1.8.0

硬件架构

x86_64

BUG 描述

开启 混入配置 -> DNS配置 -> 遵循分流规则 选项后,核心不能启动

预期行为

开启 混入配置 -> DNS配置 -> 遵循分流规则 选项后,核心能正常启动

复现步骤

开启 混入配置 -> DNS配置 -> 遵循分流规则 选项,保存启用

插件配置

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:config.yaml'
mihomo.config.mixin='1'
mihomo.config.test_profile='1'
mihomo.config.upload_profile='/etc/mihomo/profiles/config.yaml'
mihomo.config.fast_reload='1'
mihomo.proxy=proxy
mihomo.proxy.transparent_proxy='1'
mihomo.proxy.transparent_proxy_mode='tproxy'
mihomo.proxy.ipv4_dns_hijack='1'
mihomo.proxy.ipv6_dns_hijack='1'
mihomo.proxy.ipv4_proxy='1'
mihomo.proxy.ipv6_proxy='1'
mihomo.proxy.router_proxy='0'
mihomo.proxy.lan_proxy='1'
mihomo.proxy.access_control_mode='all'
mihomo.proxy.bypass_china_mainland_ip='0'
mihomo.proxy.acl_tcp_dport='21 22 80 110 143 194 443 465 993 995 8080 8443'
mihomo.proxy.acl_udp_dport='1-65535'
mihomo.proxy.wan_interfaces='wan'
mihomo.proxy.wan6_interfaces='wan_6'
mihomo.proxy.tcp_transparent_proxy_mode='redirect'
mihomo.proxy.udp_transparent_proxy_mode='tproxy'
mihomo.mixin=mixin
mihomo.mixin.mode='rule'
mihomo.mixin.match_process='off'
mihomo.mixin.unify_delay='1'
mihomo.mixin.tcp_concurrent='1'
mihomo.mixin.tcp_keep_alive_interval='600'
mihomo.mixin.log_level='info'
mihomo.mixin.ui_name='MetaCubeX'
mihomo.mixin.ui_url='https://slink.ltd/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='system'
mihomo.mixin.tun_mtu='9000'
mihomo.mixin.tun_gso='1'
mihomo.mixin.tun_gso_max_size='65536'
mihomo.mixin.tun_endpoint_independent_nat='0'
mihomo.mixin.dns_port='1053'
mihomo.mixin.dns_mode='fake-ip'
mihomo.mixin.fake_ip_range='198.18.0.1/16'
mihomo.mixin.fake_ip_filter='1'
mihomo.mixin.fake_ip_cache='1'
mihomo.mixin.dns_ipv6='1'
mihomo.mixin.dns_system_hosts='1'
mihomo.mixin.dns_hosts='1'
mihomo.mixin.hosts='0'
mihomo.mixin.dns_nameserver='1'
mihomo.mixin.dns_fallback_filter='1'
mihomo.mixin.dns_nameserver_policy='1'
mihomo.mixin.sniffer='0'
mihomo.mixin.sniff_dns_mapping='1'
mihomo.mixin.sniff_pure_ip='1'
mihomo.mixin.sniffer_overwrite_dest='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/xishang0128/geoip/releases/download/latest/GeoLite2-ASN.mmdb'
mihomo.mixin.geox_auto_update='1'
mihomo.mixin.geox_update_interval='24'
mihomo.mixin.api_secret='903789'
mihomo.mixin.fake_ip_filters='rule-set:private' 'rule-set:direct' 'geosite:cn' 'rule-set:google-cn' '+.arpara.net' '+.arpara-platform.com'
mihomo.mixin.ipv6='1'
mihomo.mixin.fake_ip_filter_mode='blacklist'
mihomo.mixin.dns_respect_rules='1'
mihomo.@authentication[0]=authentication
mihomo.@authentication[0].enabled='1'
mihomo.@authentication[0].username='mihomo'
mihomo.@authentication[0].password='903789'
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='127.0.0.1' '::1'
mihomo.@nameserver[1]=nameserver
mihomo.@nameserver[1].enabled='0'
mihomo.@nameserver[1].type='proxy-server-nameserver'
mihomo.@nameserver[1].nameserver='https://dns.alidns.com/dns-query' 'https://doh.pub/dns-query'
mihomo.@nameserver[2]=nameserver
mihomo.@nameserver[2].enabled='1'
mihomo.@nameserver[2].type='nameserver'
mihomo.@nameserver[2].nameserver='127.0.0.1' '::1'
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.@fallback_filter[0]=fallback_filter
mihomo.@fallback_filter[0].enabled='0'
mihomo.@fallback_filter[0].type='geoip-code'
mihomo.@fallback_filter[0].value='CN'
mihomo.@fallback_filter[1]=fallback_filter
mihomo.@fallback_filter[1].enabled='0'
mihomo.@fallback_filter[1].type='geosite'
mihomo.@fallback_filter[1].value='GFW'
mihomo.@fallback_filter[2]=fallback_filter
mihomo.@fallback_filter[2].enabled='0'
mihomo.@fallback_filter[2].type='ipcidr'
mihomo.@fallback_filter[3]=fallback_filter
mihomo.@fallback_filter[3].enabled='0'
mihomo.@fallback_filter[3].type='domain_name'
mihomo.@nameserver_policy[0]=nameserver_policy
mihomo.@nameserver_policy[0].enabled='1'
mihomo.@nameserver_policy[0].matcher='rule-set:google-fcm,google-cn'
mihomo.@nameserver_policy[0].nameserver='127.0.0.1' '::1'
mihomo.@nameserver_policy[1]=nameserver_policy
mihomo.@nameserver_policy[1].enabled='1'
mihomo.@nameserver_policy[1].matcher='rule-set:google'
mihomo.@nameserver_policy[1].nameserver='https://1.1.1.1/dns-query' 'https://1.0.0.1/dns-query' 'https://dns10.quad9.net/dns-query'
mihomo.@sniff[0]=sniff
mihomo.@sniff[0].enabled='1'
mihomo.@sniff[0].protocol='HTTP'
mihomo.@sniff[0].port='80' '8080-8880'
mihomo.@sniff[0].overwrite_dest='1'
mihomo.@sniff[1]=sniff
mihomo.@sniff[1].enabled='1'
mihomo.@sniff[1].protocol='TLS'
mihomo.@sniff[1].port='443' '8443'
mihomo.@sniff[1].overwrite_dest='1'
mihomo.@sniff[2]=sniff
mihomo.@sniff[2].enabled='1'
mihomo.@sniff[2].protocol='QUIC'
mihomo.@sniff[2].port='443' '8443'
mihomo.@sniff[2].overwrite_dest='1'
mihomo.editor=editor
mihomo.log=log
mihomo.@nameserver_policy[2]=nameserver_policy
mihomo.@nameserver_policy[2].enabled='1'
mihomo.@nameserver_policy[2].matcher='rule-set:direct'
mihomo.@nameserver_policy[2].nameserver='127.0.0.1' '::1'
mihomo.@nameserver_policy[3]=nameserver_policy
mihomo.@nameserver_policy[3].enabled='1'
mihomo.@nameserver_policy[3].matcher='geosite:cn'
mihomo.@nameserver_policy[3].nameserver='127.0.0.1' '::1'
mihomo.@nameserver_policy[4]=nameserver_policy
mihomo.@nameserver_policy[4].enabled='1'
mihomo.@nameserver_policy[4].matcher='rule-set:gfw,custorm-proxy,porn'
mihomo.@nameserver_policy[4].nameserver='https://1.1.1.1/dns-query' 'https://1.0.0.1/dns-query' 'https://dns10.quad9.net/dns-query'

配置文件

插件日志

[2024-09-06 12:23:23] App is enabled.
[2024-09-06 12:23:23] Starting...
[2024-09-06 12:23:23] Use Profile: config.yaml
[2024-09-06 12:23:23] Mixin is enabled, mixin all config.
[2024-09-06 12:23:23] Profile testing...
[2024-09-06 12:23:23] Profile test failed!
[2024-09-06 12:23:23] Exiting...

核心日志

time="2024-09-06T12:23:23.504640487+08:00" level=info msg="Start initial configuration in progress"
time="2024-09-06T12:23:23.506084472+08:00" level=warning msg="Skip start health check timer due to it's started"
time="2024-09-06T12:23:23.506422235+08:00" level=info msg="Geodata Loader mode: standard"
time="2024-09-06T12:23:23.506434984+08:00" level=info msg="Geosite Matcher implementation: succinct"
time="2024-09-06T12:23:23.506605312+08:00" level=info msg="Load GeoSite rule: cn"
time="2024-09-06T12:23:23.941383289+08:00" level=info msg="Finished initial GeoSite rule cn => DIRECT, records: 92313"
time="2024-09-06T12:23:23.941431132+08:00" level=error msg="if “respect-rules” is turned on, “proxy-server-nameserver” cannot be empty"
configuration file /etc/mihomo/run/config.yaml test failed
time="2024-09-06T12:23:23.965758286+08:00" level=warning msg="Mihomo shutting down"

附加信息

根据日志显示 dns.respect-rules 需要和 dns.proxy-server-nameserver 同时使用。 考虑是否需要根据 遵循分流规则 启用状态增加是否覆盖 proxy-server-nameserver 的选项

morytyann commented 1 month ago

根据日志显示dns.respect-rules需要和dns.proxy-server-nameserver同时使用。

这时预期行为,不是BUG,如果你觉得是BUG,你应该去核心那边反馈。

考虑是否需要根据遵循分流规则启用状态增加是否覆盖proxy-server-nameserver的选项

  1. 如果你想说的是选项,覆盖DNS 服务器里已经包含了
  2. 如果你想说的是校验,首先这个在LuCI上不好做,其次就是已经有检查配置文件这个功能了,它由核心提供,插件没有必要再实现一遍
SharerMax commented 1 month ago

根据日志显示dns.respect-rules需要和dns.proxy-server-nameserver同时使用。

这时预期行为,不是BUG,如果你觉得是BUG,你应该去核心那边反馈。

考虑是否需要根据遵循分流规则启用状态增加是否覆盖proxy-server-nameserver的选项

  1. 如果你想说的是选项,覆盖DNS 服务器里已经包含了
  2. 如果你想说的是校验,首先这个在LuCI上不好做,其次就是已经有检查配置文件这个功能了,它由核心提供,插件没有必要再实现一遍

明白了,感谢