diff --git a/README.md b/README.md index 80c2541..869a4a8 100755 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Box for Magisk + [![id](https://img.shields.io/badge/id-blue.svg?style=for-the-badge)](docs/index_id.md) [![en](https://img.shields.io/badge/en-blue.svg?style=for-the-badge)](docs/index_en.md) [![cn](https://img.shields.io/badge/cn-blue.svg?style=for-the-badge)](docs/index_cn.md)

- BOX + BOX
BOX

Transparent Proxy for Android(root)

-
[![android](https://img.shields.io/badge/Android-3DDC84?style=for-the-badge&logo=android&logoColor=white)]() @@ -17,10 +17,10 @@ This project is a [Magisk](https://github.com/topjohnwu/Magisk) module which includes `clash`, `sing-box`, `v2ray` and `xray` proxies. - ## Tun (tcp + udp) -```open and edit /data/adb/box/settings.ini``` +`open and edit /data/adb/box/settings.ini` + ```shell # select the client to use : clash / sing-box / xray / v2fly bin_name="good day" @@ -29,6 +29,7 @@ proxy_mode="tun" # change to tun ``` **sing-box config.json** + ```json "inbounds": [ { @@ -47,6 +48,7 @@ proxy_mode="tun" # change to tun } ], ``` + ```json "route": { "final": "PROXY", @@ -56,11 +58,12 @@ proxy_mode="tun" # change to tun "outbound": "dns-out" }, ], - "auto_detect_interface": true // set true, + "auto_detect_interface": true // set true, } ``` **clash config.yaml** + ```yaml tun: enable: true @@ -78,10 +81,10 @@ tun: inet6-address: [fdfe:dcba:9876::1/126] ``` - ## Mixed (redirec tcp + tun udp) -```open and edit /data/adb/box/settings.ini``` +`open and edit /data/adb/box/settings.ini` + ```shell # select the client to use : clash / sing-box / xray / v2fly bin_name="good day" @@ -95,6 +98,7 @@ proxy_mode="blacklist" ``` **sing-box config.json** + ```json "inbounds": [ { @@ -120,6 +124,7 @@ proxy_mode="blacklist" } ] ``` + ```json "route": { "final": "PROXY", @@ -129,11 +134,12 @@ proxy_mode="blacklist" "outbound": "dns-out" }, ], - "auto_detect_interface": true // set true, + "auto_detect_interface": true // set true, } ``` **clash config.yaml** + ```yaml redir-port: 9797 @@ -153,9 +159,10 @@ tun: inet6-address: [fdfe:dcba:9876::1/126] ``` - ## Tproxy (tcp + tun) -```open and edit /data/adb/box/settings.ini``` + +`open and edit /data/adb/box/settings.ini` + ```shell # select the client to use : clash / sing-box / xray / v2fly bin_name="good day" @@ -167,8 +174,9 @@ network_mode="tproxy" # change to tproxy # Proxy mode: blacklist / whitelist / tun (only tun auto-route) proxy_mode="blacklist" ``` - + **sing-box config.json** + ```json "inbounds": [ { @@ -186,26 +194,27 @@ proxy_mode="blacklist" ``` **clash config.yaml** + ```yaml tproxy-port: 9898 - # tun: - # enable: false - # # biarkan default utun - # device: utun - # mtu: 9000 - # # gvisor / lwip / system - # stack: system - # dns-hijack: - # - any:53 - # auto-route: true - # auto-detect-interface: true - # # end - # inet4-address: 172.19.0.1/30 - # inet6-address: [fdfe:dcba:9876::1/126] +# enable: false +# # biarkan default utun +# device: utun +# mtu: 9000 +# # gvisor / lwip / system +# stack: system +# dns-hijack: +# - any:53 +# auto-route: true +# auto-detect-interface: true +# # end +# inet4-address: 172.19.0.1/30 +# inet6-address: [fdfe:dcba:9876::1/126] ``` **xray/v2ray config.json** + ```json "inbounds": [ { @@ -235,6 +244,6 @@ tproxy-port: 9898 #### make sure the ports in settings.ini and configuration are in sync. - ## Credits - - [CHIZI-0618/box4magisk](https://github.com/CHIZI-0618/box4magisk) \ No newline at end of file + +- [CHIZI-0618/box4magisk](https://github.com/CHIZI-0618/box4magisk) diff --git a/docs/box.svg b/docs/box.svg new file mode 100644 index 0000000..9745e50 --- /dev/null +++ b/docs/box.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + diff --git a/docs/index_cn.md b/docs/index_cn.md index e4f648c..a47489b 100644 --- a/docs/index_cn.md +++ b/docs/index_cn.md @@ -1,94 +1,105 @@ -## WARNING -该项目不负责:损坏设备、损坏SD卡或烧毁SoCs。 +## 注意 + +该项目不负责:损坏设备、损坏 SD 卡或烧毁 SoCs。 **请确保您的配置文件不会引起流量回环,否则可能会导致您的手机无限重启。** 如果你真的不知道如何配置这个模块,你可能需要一个像 **ClashForAndroid、ClashMetaForAndroid、v2rayNG、Surfboard、SagerNet、AnXray、NekoBox** 等应用程序。 ## 安装 -- 从RELEASE下载模块zip包,并通过MAGISK安装它。然后重新启动设备。 -- 确保您已连接到互联网,并执行以下命令以下载二进制文件等: -```shell - su -c /data/adb/box/scripts/box.tool upyacd -``` -```shell - su -c /data/adb/box/scripts/box.tool subgeo -``` -```shell - su -c /data/adb/box/scripts/box.tool upcore -``` -- 支持在 Magisk Manager 中进行下一个在线模块更新(更新模块将在不重新启动设备的情况下生效)。 +- 从 RELEASE 下载模块 zip 包,并通过 `Magisk` / `KernelSU` 安装它。安装时会询问是否下载全量包,您可以选择**全量下载**或者稍后再**单独下载**,然后重新启动设备。 +- 本模块支持在 `Magisk Manager` 中进行下一个在线模块更新(更新模块将在不重新启动设备的情况下生效)。 -### Notes -此模块包括: - - [clash](https://github.com/Dreamacro/clash)、 - - [clash.meta](https://github.com/MetaCubeX/Clash.Meta)、[sing-box](https://github.com/SagerNet/sing-box)、 - - [v2ray-core](https://github.com/v2fly/v2ray-core)、 - - [Xray-core](https://github.com/XTLS/Xray-core). - - [sing-box](). - -安装完模块后,下载适合您设备架构的核心文件,并将其放置在/data/adb/box/bin/目录中,或执行以下命令: +### 内核更新 -```shell +此模块包括如下几种内核: + +- [clash](https://github.com/Dreamacro/clash) +- [clash.meta](https://github.com/MetaCubeX/Clash.Meta) +- [sing-box](https://github.com/SagerNet/sing-box) +- [v2ray-core](https://github.com/v2fly/v2ray-core) +- [Xray-core](https://github.com/XTLS/Xray-core) + +内核对应的配置为 `${bin_name}`, 可以设置为( `clash` | `xray` | `v2ray` | `sing-box`). + +每个核心都在`/data/adb/box/bin/${bin_name}`目录中工作,核心名称由 `/data/adb/box//settings.ini` 文件中的 `bin_name` 确定。 + +确保您已连接到互联网,并执行以下命令以更新内核文件: + +```sh +# 更新选定的内核 su -c /data/adb/box/scripts/box.tool upcore ``` -or, +如果您使用 `clash` 作为你的选定内核,您可能还需要执行如下指令开启控制面板: -```shell +```sh +# 更新 Clash 管理面板 +su -c /data/adb/box/scripts/box.tool upyacd +``` + +或者,您可以将所有操作一次性执行(这可能造成不必要的存储空间浪费): + +```sh +# 更新所有文件(包括不同种类的内核) su -c /data/adb/box/scripts/box.tool all ``` ## 配置 -- ${bin_name}: - - clash - - xray - - v2ray - - sing-box -- 每个核心都在/data/adb/box/bin/${bin_name}目录中工作,核心名称由BFM文件中的bin_name确定。 -- 每个核心配置文件需要由用户进行自定义,并且脚本将检查配置的有效性,检查结果将保存在文件/data/adb/box/run/runs.log中。 -- 提示:clash和sing-box都带有透明代理脚本的预配置。有关更多配置,请参阅官方文档。地址:[dokumen clash](https://github.com/Dreamacro/clash/wiki/configuration), [dokumen sing-box](https://sing-box.sagernet.org/configuration/outbound/) +**以下核心服务被称为 BFM** -## 说明 -### 常规方法(标准和推荐方法) -#### 启动和停止管理服务 -**以下核心服务被称为BFM** -- 以下核心服务集体称为BFM -- 您可以通过 Magisk Manager 应用程序实时启用或禁用模块以启动或停止BFM服务,无需重新启动设备。启动服务可能需要几秒钟的时间,停止服务可以立即生效。 +- 以下核心服务集体称为 BFM +- 您可以通过 Magisk Manager 应用程序实时启用或禁用模块以启动或停止 BFM 服务,无需重新启动设备。启动服务可能需要几秒钟的时间,停止服务可以立即生效。 -#### 选择需要代理的应用程序(APP) -- BFM默认为所有Android用户的所有应用程序(APP)提供代理。 -- 如果您想让BFM代理所有应用程序(APP),除了某些应用程序,请打开文件/data/adb/box/settings.ini,将proxy_mode的值更改为blacklist(默认),将要排除的应用程序添加到packages_list,例如:packages_list=("com.termux" "org.telegram.messenger") -- 如果您只想代理某些应用程序(APP),请使用whitelist。 -- 当proxy_mode的值为core/tun时,透明代理将不起作用,仅启动相应的内核,用于支持TUN,目前仅有clash和sing-box可用。 +### 核心配置 + +- 核心 `bin_name` 配置请查询**内核更新**部分进行配置即可 +- 每个核心配置文件需要由用户进行自定义,并且脚本将检查配置的有效性,检查结果将保存在文件 `/data/adb/box/run/runs.log` 中。 +- 提示:`clash` 和 `sing-box` 都带有透明代理脚本的预配置。有关更多配置,请参阅官方文档。地址:[Clash 官方文档](https://github.com/Dreamacro/clash/wiki/configuration)、[sing-box 官方文档](https://sing-box.sagernet.org/configuration/outbound/) + +### 应用过滤(白/黑名单) + +- BFM 默认为所有 Android 用户的所有应用程序(APP)提供代理。 +- 如果您想让 BFM 代理所有应用程序(APP),除了某些应用程序,请打开文件/data/adb/box/settings.ini,将 proxy_mode 的值更改为 blacklist(默认),将要排除的应用程序添加到 packages_list,例如:packages_list=("com.termux" "org.telegram.messenger") +- 如果您只想代理某些应用程序(APP),请使用 whitelist。 +- 当 proxy_mode 的值为 core/tun 时,透明代理将不起作用,仅启动相应的内核,用于支持 TUN,目前仅有 clash 和 sing-box 可用。 - 如果使用 Clash,在 fake-ip 模式下,黑名单和白名单将无法生效。 -### 高级用法 -#### 更改代理模式 -- BFM使用TPROXY来透明代理TCP + UDP(默认)。如果检测到设备不支持TPROXY,请打开/data/adb/box/settings.ini并将network_mode="redirect"更改为仅使用TCP代理的redirect。 -- 打开文件/data/adb/box/settings.ini,将network_mode的值更改为redirect、tproxy或mixed。 -- redirect:仅重定向TCP。 -- tproxy:重定向TCP + UDP。 -- mixed:重定向TCP和tun UDP。 +### 更改代理模式 + +- BFM 使用 TPROXY 来透明代理 TCP + UDP(默认)。如果检测到设备不支持 TPROXY,请打开/data/adb/box/settings.ini 并将 network_mode="redirect"更改为仅使用 TCP 代理的 redirect。 +- 打开文件/data/adb/box/settings.ini,将 network_mode 的值更改为 redirect、tproxy 或 mixed。 +- redirect:仅重定向 TCP。 +- tproxy:重定向 TCP + UDP。 +- mixed:重定向 TCP 和 tun UDP。 + +### 在连接到 Wi-Fi 或热点时绕过透明代理 -#### 在连接到 Wi-Fi 或热点时绕过透明代理 - BFM 默认透明代理本地主机和热点(包括 USB 共享网络)。 - 打开文件 /data/adb/box/settings.ini,修改 ignore_out_list 并添加 wlan+,这样透明代理将绕过 wlan,并且热点不会连接到代理。 - 打开文件 /data/adb/box/settings.ini,修改 ap_list 并添加 wlan+。BFM 将代理热点(对于联发科设备,可能是 ap+ / wlan+)。 - 使用终端中的 ifconfig 命令找出 AP 的名称。 -#### 进入手动模式 +## 启动和停止 + +### 进入手动模式 + - 如果您想通过运行命令来完全控制 BFM,只需创建一个名为 /data/adb/box/manual 的新文件。在这种情况下,当您的设备开机时,BFM 服务将不会自动启动,您也无法通过 Magisk Manager 应用程序设置服务的启动或停止。 -#### 启动和停止管理服务 + +### 启动和停止管理服务 + - BFM 服务脚本为 /data/adb/box/scripts/box.service - 启动 BFM: + ```shell su -c /data/adb/box/scripts/box.service start ``` + - 停止 BFM: + ```shell su -c /data/adb/box/scripts/box.service stop ``` @@ -96,33 +107,69 @@ su -c /data/adb/box/scripts/box.tool all - 终端会同时打印日志并将其输出到日志文件中。 #### 管理透明代理是否启用 + - 透明代理脚本是 /data/adb/box/scripts/box.iptables。 - 启用透明代理: + ```shell su -c /data/adb/box/scripts/box.iptables enable ``` - 禁用透明代理: + ```shell su -c /data/adb/box/scripts/box.iptables disable ``` +## 订阅及Geo数据库更新 + +您可以使用如下指令同时更新订阅以及 Geo 数据库: + +```shell + su -c /data/adb/box/scripts/box.tool geosub +``` + +或者您可以单独更新他们。 + +### 更新订阅 + +```shell + su -c /data/adb/box/scripts/box.tool subs +``` + +### 更新 Geo 数据库 + +```shell + su -c /data/adb/box/scripts/box.tool geox +``` + ## 其他指令 -- 在修改任何核心配置文件时,请确保tproxy相关的配置与/data/adb/box/settings.ini文件中的定义一致。 -- 如果设备有公共IP地址,请在/data/adb/box/scripts/box.iptables文件中将该IP添加到内网中,以防止流量循环。 -- 可以在/data/adb/box/run目录中找到BFM服务的日志。 + +- 在修改任何核心配置文件时,请确保 tproxy 相关的配置与/data/adb/box/settings.ini 文件中的定义一致。 +- 如果设备有公共 IP 地址,请在/data/adb/box/scripts/box.iptables 文件中将该 IP 添加到内网中,以防止流量循环。 +- 可以在/data/adb/box/run 目录中找到 BFM 服务的日志。 + +您可以运行如下指令获取其他更多相关操作指令: + +```shell + su -c /data/adb/box/scripts/box.tool + # usage: $0 {rconf|reload|upyacd|upcore|upyq|cgroup|port|geox|subs|geosub|all} + su -c /data/adb/box/scripts/box.service + # usage: $0 {start|stop|restart|usage} + su -c /data/adb/box/scripts/box.iptables + # usage: $0 {enable|disable|renew} +``` ## 卸载 -- 从Magisk Manager中删除此模块的安装将删除/data/adb/service.d/box_service.sh,并保留BFM数据目录位于/data/adb/box。 -- 您可以使用以下命令删除BFM数据: + +- 从 Magisk Manager 中删除此模块的安装将删除/data/adb/service.d/box_service.sh,并保留 BFM 数据目录位于/data/adb/box。 +- 您可以使用以下命令删除 BFM 数据: ```shell su -c rm -rf /data/adb/box ``` + ```shell su -c rm -rf /data/adb/service.d/box_service.sh ``` - -## CHANGELOG -[CHANGELOG](CHANGELOG.md) diff --git a/docs/index_en.md b/docs/index_en.md index add83ec..5d16485 100644 --- a/docs/index_en.md +++ b/docs/index_en.md @@ -137,4 +137,4 @@ The `BFM` service script is /data/adb/box/scripts/box.service ``` ## CHANGELOG -[CHANGELOG](CHANGELOG.md) +[CHANGELOG](../CHANGELOG.md) diff --git a/docs/index_id.md b/docs/index_id.md index 11dae44..e08b984 100755 --- a/docs/index_id.md +++ b/docs/index_id.md @@ -138,4 +138,4 @@ Jika Anda ingin mengontrol `BFM` sepenuhnya dengan menjalankan perintah, buat sa ``` ## CHANGELOG -[CHANGELOG](CHANGELOG.md) +[CHANGELOG](../CHANGELOG.md)