CHIZI-0618 / box4magisk

Use sing-box, clash, v2ray, xray tunnel proxy on Android devices.
GNU General Public License v3.0
1.07k stars 111 forks source link

新增的mihomo支持tun模式system出现微信图片无法发送,国内b站无法加载视频。 #60

Closed yenaNs closed 1 month ago

yenaNs commented 1 month ago

使用mihomo核心mihomo-android-arm64-v8-alpha-0e22876-1 已按要求重命名核心为"mihomo",且box.config中bin_name="mihomo"。启用tun system模式,出现标题问题。

随后关闭,更改bin_name="clash"(bin未重命名)可以启动,使用tun模式,b站及微信发送图片正常,但无法通过magisk开关关闭(很可能是bin没重命名的问题)。主要问题在于tun模式。

mixed-port: 7890 redir-port: 7891 tproxy-port: 1536 allow-lan: true mode: rule geodata-mode: true unified-delay: true log-level: silent ipv6: false external-controller: 0.0.0.0:9090 external-ui: ./dashboard/Yacd secret: "" enable-process: true find-process-mode: strict

tcp-concurrent: true

global-client-fingerprint: chrome

geox-url: geoip: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat" geosite: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat" mmdb: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country.mmdb"

profile: store-selected: true store-fake-ip: true

sniffer: enable: false sniff: TLS: ports: [443, 8443] HTTP: ports: [80, 8080-8880] override-destination: true

tun: enable: true device: tun3 stack: system inet6-address: dns-hijack:

dns: enable: true listen: 0.0.0.0:1053 ipv6: false enhanced-mode: fake-ip fake-ip-range: 198.18.0.0/15 fake-ip-filter:

yenaNs commented 1 month ago

小米hyper1.0.1.0 magisk kitsune 27001(R65C33E4F-kitsune) Android14(API 34) arm64-v8a API版本100

KINGYJL commented 1 month ago

如果使用的是sing-box,有没有什么办法在线自动更新节点连接,并生成配置文件,然后内核自动识别配置文件,并运行更新后的配置文件。(或者就是运行连接内的节点。不需要config.json,因为本地文件不支持更新,连接可以时时更新)大佬!

yenaNs commented 1 month ago

如果使用的是sing-box,有没有什么办法在线自动更新节点连接,并生成配置文件,然后内核自动识别配置文件,并运行更新后的配置文件。(或者就是运行连接内的节点。不需要config.json,因为本地文件不支持更新,连接可以时时更新)大佬!

这是另一个issue,项目给定的默认配置文件已经提供了providers模板,它提到了base64格式的订阅链接,并定时更新转存为订阅文件。你可以修改这些这些参数。参照这个

CHIZI-0618 commented 1 month ago

如果使用的是sing-box,有没有什么办法在线自动更新节点连接,并生成配置文件,然后内核自动识别配置文件,并运行更新后的配置文件。(或者就是运行连接内的节点。不需要config.json,因为本地文件不支持更新,连接可以时时更新)大佬!

可参考 https://gist.github.com/CHIZI-0618/fc3495cd15b3ab3d53c77872ebece8ae 注意时效性,具体可以看各个项目的 Readme

CHIZI-0618 commented 1 month ago

使用mihomo核心mihomo-android-arm64-v8-alpha-0e22876-1 已按要求重命名核心为"mihomo",且box.config中bin_name="mihomo"。启用tun system模式,出现标题问题。

随后关闭,更改bin_name="clash"(bin未重命名)可以启动,使用tun模式,b站及微信发送图片正常,但无法通过magisk开关关闭(很可能是bin没重命名的问题)。主要问题在于tun模式。

mixed-port: 7890 redir-port: 7891 tproxy-port: 1536 allow-lan: true mode: rule geodata-mode: true unified-delay: true log-level: silent ipv6: false external-controller: 0.0.0.0:9090 external-ui: ./dashboard/Yacd secret: "" enable-process: true find-process-mode: strict #tcp-concurrent: true global-client-fingerprint: chrome

geox-url: geoip: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat" geosite: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat" mmdb: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country.mmdb"

profile: store-selected: true store-fake-ip: true

sniffer: enable: false sniff: TLS: ports: [443, 8443] HTTP: ports: [80, 8080-8880] override-destination: true

tun: enable: true device: tun3 stack: system inet6-address: dns-hijack: - 'any:53' auto-route: true auto-detect-interface: true

dns: enable: true listen: 0.0.0.0:1053 ipv6: false enhanced-mode: fake-ip fake-ip-range: 198.18.0.0/15 fake-ip-filter: - '*' - '+.lan' - 'connect.rom.miui.com' default-nameserver: - 'https://223.5.5.5/dns-query' nameserver: - 'https://8.8.8.8/dns-query#dns' - 'https://1.1.1.1/dns-query#dns' proxy-server-nameserver: - https://doh.pub/dns-query nameserver-policy: "geosite:cn,private": - https://dns.alidns.com/dns-query

是否使用 core 模式从而禁用了透明代理,我注意到你开启了 Tun

yenaNs commented 1 month ago

使用mihomo核心mihomo-android-arm64-v8-alpha-0e22876-1 已按要求重命名核心为"mihomo",且box.config中bin_name="mihomo"。启用tun system模式,出现标题问题。

随后关闭,更改bin_name="clash"(bin未重命名)可以启动,使用tun模式,b站及微信发送图片正常,但无法通过magisk开关关闭(很可能是bin没重命名的问题)。主要问题在于tun模式。

mixed-port: 7890 redir-port: 7891 tproxy-port: 1536 allow-lan: true mode: rule geodata-mode: true unified-delay: true log-level: silent ipv6: false external-controller: 0.0.0.0:9090 external-ui: ./dashboard/Yacd secret: "" enable-process: true find-process-mode: strict #tcp-concurrent: true global-client-fingerprint: chrome

geox-url: geoip: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat" geosite: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat" mmdb: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country.mmdb"

profile: store-selected: true store-fake-ip: true

sniffer: enable: false sniff: TLS: ports: [443, 8443] HTTP: ports: [80, 8080-8880] override-destination: true

tun: enable: true device: tun3 stack: system inet6-address: dns-hijack: - 'any:53' auto-route: true auto-detect-interface: true

dns: enable: true listen: 0.0.0.0:1053 ipv6: false enhanced-mode: fake-ip fake-ip-range: 198.18.0.0/15 fake-ip-filter: - '*' - '+.lan' - 'connect.rom.miui.com' default-nameserver: - 'https://223.5.5.5/dns-query' nameserver: - 'https://8.8.8.8/dns-query#dns' - 'https://1.1.1.1/dns-query#dns' proxy-server-nameserver: - https://doh.pub/dns-query nameserver-policy: "geosite:cn,private": - https://dns.alidns.com/dns-query

是否使用 core 模式从而禁用了透明代理,我注意到你开启了 Tun

这是配置

!/system/bin/sh

bin_name="mihomo" redir_port="7891" tproxy_port="1536" clash_dns_port="1053" clash_dns_listen="0.0.0.0:${clash_dns_port}" fake_ip_range_v4="198.18.0.0/15" fake_ip_range_v6="fc00::/18" tun_device="tun0" tun_forward="enable" box_user_group="root:net_admin"

If you want to change the user or group, you must make the Box core in the /system/bin directory, otherwise the changes will not take effect.

If you are using Magisk, you can copy the Box core files (sing-box, clash, etc.) to /data/adb/modules/bin_files/system/bin/ and reboot the phone

bin_name_list=("sing-box" "clash" "mihomo" "xray" "v2ray" "hysteria") box_path="/data/adb/box" bin_path="${box_path}/bin/${bin_name}" run_path="${box_path}/run" pid_file="${run_path}/${bin_name}.pid" intranet=(0.0.0.0/8 10.0.0.0/8 100.0.0.0/8 127.0.0.0/8 169.254.0.0/16 192.0.0.0/24 192.0.2.0/24 192.88.99.0/24 192.168.0.0/16 198.51.100.0/24 203.0.113.0/24 224.0.0.0/4 240.0.0.0/4 255.255.255.255/32)

The use of 100.0.0.0/8 instead of 100.64.0.0/10 is purely due to a mistake by China Telecom's service provider, and you can change it back.

intranet6=(::/128 ::1/128 ::ffff:0:0/96 100::/64 64:ff9b::/96 2001::/32 2001:10::/28 2001:20::/28 2001:db8::/32 2002::/16 fe80::/10 ff00::/8) ipv6="disable" proxy_method="TPROXY"

REDIRECT: TCP only / TPROXY: TCP + UDP / MIXED: REDIRECT TCP + TUN UDP

proxy_mode="blacklist"

blacklist / whitelist / core

user_packages_list=()

Android User:Package Name, For example:

user_packages_list=("0:com.android.captiveportallogin" "10:com.tencent.mm")

gid_list=()

The gid in the list will be bypassed or proxied according to the proxy_mode configuration, and the gid can be arbitrarily specified by the busybox setuidgid command

ap_list=("wlan+" "ap+" "rndis+") ignore_out_list=() bin_name="mihomo" bin_name_list=("sing-box" "clash" "xray" "v2ray") 此时配置会出现问题。 Screenshot_2024-07-23-18-11-21-610_com.xiaomi.market.jpg

Screenshot_2024-07-23-18-13-36-267_tv.danmaku.bili.jpg

但是其他应用并不受到影响。 Screenshot_2024-07-23-18-14-06-448_alook.browser.jpg

bin_name="clash" bin_name_list=("sing-box" "clash" "xray" "v2ray") 时,问题消失。 总的来说,当mihomo核心以bin_name="clash"启动是正常的。 而bin_name="mihomo"就会出现如上问题。

yenaNs commented 1 month ago

使用mihomo核心mihomo-android-arm64-v8-alpha-0e22876-1 已按要求重命名核心为"mihomo",且box.config中bin_name="mihomo"。启用tun system模式,出现标题问题。

随后关闭,更改bin_name="clash"(bin未重命名)可以启动,使用tun模式,b站及微信发送图片正常,但无法通过magisk开关关闭(很可能是bin没重命名的问题)。主要问题在于tun模式。

mixed-port: 7890 redir-port: 7891 tproxy-port: 1536 allow-lan: true mode: rule geodata-mode: true unified-delay: true log-level: silent ipv6: false external-controller: 0.0.0.0:9090 external-ui: ./dashboard/Yacd secret: "" enable-process: true find-process-mode: strict #tcp-concurrent: true global-client-fingerprint: chrome

geox-url: geoip: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat" geosite: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat" mmdb: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country.mmdb"

profile: store-selected: true store-fake-ip: true

sniffer: enable: false sniff: TLS: ports: [443, 8443] HTTP: ports: [80, 8080-8880] override-destination: true

tun: enable: true device: tun3 stack: system inet6-address: dns-hijack: - 'any:53' auto-route: true auto-detect-interface: true

dns: enable: true listen: 0.0.0.0:1053 ipv6: false enhanced-mode: fake-ip fake-ip-range: 198.18.0.0/15 fake-ip-filter: - '*' - '+.lan' - 'connect.rom.miui.com' default-nameserver: - 'https://223.5.5.5/dns-query' nameserver: - 'https://8.8.8.8/dns-query#dns' - 'https://1.1.1.1/dns-query#dns' proxy-server-nameserver: - https://doh.pub/dns-query nameserver-policy: "geosite:cn,private": - https://dns.alidns.com/dns-query

是否使用 core 模式从而禁用了透明代理,我注意到你开启了 Tun

我定位到了问题。 当开启了小米的数据并发加速时会触发这个bug。 mmexport1721779306430.jpg

关闭以后一切正常。 进一步测试以后发现,不论以"mihomo"还是"clash"启动都会有这个问题,造成之前假象的原因是,部分勾选了数据加速的软件在我关闭代理调试时,连接到服务器以后可以正常使用。(但大部分软件并不能,实测以后微信可以) Screenshot_2024-07-24-08-10-32-871_com.android.settings.jpg 进一步排查发现,无论tun是否开启都会有被数据加速的APP出现无网络或仅部分功能可用的情况,但不开启tun时聊天软件正常。(聊天软件表现情况不稳定,可能与tun并无关系)

触发条件 1.开启小米数据并发加速 2.需要连接WiFi且数据可用并开启(触发数据加速条件)

表现 被勾选数据加速的APP无网络或部分功能可用。

yenaNs commented 1 month ago

@CHIZI-0618 一个新的问题 proxy_mode="blacklist" user_packages_list 添加的APP无网络(已排除之前的无网络bug)

CHIZI-0618 commented 1 month ago

你开了 Tproxy,还启用了核心的 Tun,请看 Readme

Tproxy 的 blacklist 与 fakeip 冲突

还有,模块与系统的 数据网络加速,双 WiFi ,私人 DNS 等功能冲突,可以考虑使用客户端