Merge pull request #34 from ChadGreen01/master

Update CN readme and use svg banner
This commit is contained in:
shioeri
2023-06-25 15:48:43 +07:00
committed by GitHub
5 changed files with 301 additions and 92 deletions

View File

@@ -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)
<h1 align="center">
<img src="https://github.com/taamarin/box_for_magisk/blob/master/docs/box.png" alt="BOX" width="200">
<img src="https://github.com/taamarin/box_for_magisk/blob/master/docs/box.svg" alt="BOX" width="200">
<br>BOX<br>
</h1>
<h4 align="center">Transparent Proxy for Android(root)</h4>
<div align="center">
[![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)
- [CHIZI-0618/box4magisk](https://github.com/CHIZI-0618/box4magisk)

153
docs/box.svg Normal file
View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 1152 1152">
<g stroke-width="2.00" fill="none" stroke-linecap="butt">
<path stroke="#d3d300" stroke-opacity="0.702" vector-effect="non-scaling-stroke" d="
M 1057.33 754.51
Q 1055.07 752.19 1046.49 741.76
Q 1041.84 736.10 1032.77 727.95
C 912.98 620.37 724.76 675.64 679.96 829.50"
/>
<path stroke="#d3d300" stroke-opacity="0.702" vector-effect="non-scaling-stroke" d="
M 679.96 944.50
C 689.79 979.39 707.46 1011.23 732.71 1037.35"
/>
<path stroke="#cbc900" stroke-opacity="0.753" vector-effect="non-scaling-stroke" d="
M 679.96 944.50
Q 669.28 905.87 673.00 867.75
Q 674.67 850.63 679.96 829.50"
/>
</g>
<path fill="#656401" fill-opacity="0.400" d="
M 195.95 299.20
C 205.17 281.40 218.22 274.25 235.02 265.19
Q 375.97 189.19 516.94 113.25
Q 528.68 106.93 534.88 104.42
Q 582.62 85.15 628.57 109.94
Q 778.31 190.69 928.02 271.52
Q 945.75 281.09 955.53 298.72
C 964.15 314.29 966.15 335.25 961.03 352.79
Q 954.29 375.88 935.83 389.53
Q 931.55 392.70 918.64 399.67
Q 772.33 478.61 625.99 557.49
C 594.74 574.34 556.88 574.31 525.01 557.18
Q 380.27 479.38 235.61 401.44
Q 221.50 393.83 218.20 391.61
Q 195.14 376.06 189.13 348.59
C 185.34 331.30 187.80 314.94 195.95 299.20
Z"
/>
<path fill="#656401" fill-opacity="0.400" d="
M 94.58 536.50
C 94.52 497.85 122.94 467.79 161.24 466.18
C 175.08 465.60 186.37 469.30 198.75 475.50
Q 332.74 542.61 466.68 609.84
Q 466.80 609.90 473.00 612.91
Q 516.42 634.02 534.07 678.98
C 541.86 698.81 541.34 718.14 541.32 739.81
Q 541.26 849.32 541.32 958.84
C 541.33 967.46 542.49 985.12 540.89 995.20
Q 535.75 1027.44 509.86 1044.24
C 492.90 1055.24 472.90 1058.38 453.43 1052.66
Q 447.34 1050.87 435.08 1044.77
Q 297.66 976.31 160.29 907.74
C 127.84 891.54 104.90 860.20 97.37 825.52
C 94.25 811.16 94.61 796.31 94.66 780.44
Q 94.84 725.24 94.58 536.50
Z"
/>
<path fill="#656401" fill-opacity="0.400" d="
M 1057.33 754.51
Q 1055.07 752.19 1046.49 741.76
Q 1041.84 736.10 1032.77 727.95
C 912.98 620.37 724.76 675.64 679.96 829.50
L 679.56 829.58
A 0.83 0.53 -88.1 0 0 679.09 830.26
Q 678.94 831.48 678.26 832.51
A 0.23 0.20 -66.5 0 0 678.37 832.85
Q 678.47 832.87 678.56 832.80
Q 678.67 832.71 678.61 832.83
Q 676.57 837.46 676.03 842.52
A 0.67 0.59 -22.8 0 1 675.84 842.91
C 675.52 843.22 675.58 842.96 675.47 843.49
C 672.94 856.54 671.34 869.37 671.34 882.91
C 671.34 890.57 670.93 898.10 671.82 905.84
Q 672.18 909.00 672.62 914.07
Q 673.55 924.75 679.17 943.76
Q 679.37 944.41 679.96 944.50
C 689.79 979.39 707.46 1011.23 732.71 1037.35
Q 722.61 1042.09 712.78 1047.34
C 670.99 1069.63 621.00 1046.06 611.65 1000.01
Q 610.27 993.21 610.25 980.38
Q 610.09 851.07 610.22 721.75
C 610.26 680.94 630.70 642.89 664.87 620.81
Q 670.24 617.34 682.42 611.25
Q 819.56 542.66 956.79 474.26
Q 967.94 468.70 980.07 467.03
C 1016.79 462.00 1051.21 488.81 1056.63 525.09
Q 1057.47 530.66 1057.49 545.05
Q 1057.63 649.77 1057.33 754.51
Z"
/>
<path fill="#ffff00" d="
M 1057.33 754.51
Q 1059.44 758.26 1062.20 761.87
C 1090.45 798.82 1104.31 845.36 1103.93 891.58
C 1103.60 930.86 1090.60 970.79 1069.82 1003.81
C 1006.85 1103.88 873.04 1134.17 773.66 1070.39
C 759.33 1061.19 744.65 1049.58 732.71 1037.35
C 707.46 1011.23 689.79 979.39 679.96 944.50
Q 669.28 905.87 673.00 867.75
Q 674.67 850.63 679.96 829.50
C 724.76 675.64 912.98 620.37 1032.77 727.95
Q 1041.84 736.10 1046.49 741.76
Q 1055.07 752.19 1057.33 754.51
Z
M 851.94 923.56
Q 852.05 945.65 852.00 967.75
Q 851.98 977.20 855.07 983.92
C 871.51 1019.70 923.99 1008.04 924.00 968.25
Q 924.00 945.78 924.00 923.45
A 0.48 0.48 0.0 0 1 924.48 922.97
Q 942.15 923.06 959.81 922.97
Q 974.14 922.90 979.64 921.25
C 998.87 915.49 1009.48 892.89 1002.25 874.56
C 997.93 863.62 989.15 855.61 977.87 852.49
Q 972.48 850.99 958.00 851.00
Q 941.19 851.01 924.46 850.99
A 0.47 0.47 0.0 0 1 923.99 850.52
Q 924.03 833.65 923.99 816.79
Q 923.96 803.95 922.41 798.49
C 916.05 776.14 889.82 765.36 869.79 777.54
Q 852.22 788.22 852.10 809.76
Q 851.98 830.22 852.00 850.52
A 0.49 0.49 0.0 0 1 851.51 851.01
Q 833.03 850.97 814.56 851.02
Q 803.84 851.05 799.15 852.22
C 778.80 857.28 766.12 878.74 773.53 898.77
C 779.15 913.99 792.35 922.89 808.76 922.92
Q 830.08 922.96 851.43 923.06
A 0.51 0.50 0.0 0 1 851.94 923.56
Z"
/>
<path fill="#645e01" fill-opacity="0.502" d="
M 679.96 829.50
Q 674.67 850.63 673.00 867.75
Q 669.28 905.87 679.96 944.50
Q 679.37 944.41 679.17 943.76
Q 673.55 924.75 672.62 914.07
Q 672.18 909.00 671.82 905.84
C 670.93 898.10 671.34 890.57 671.34 882.91
C 671.34 869.37 672.94 856.54 675.47 843.49
C 675.58 842.96 675.52 843.22 675.84 842.91
A 0.67 0.59 -22.8 0 0 676.03 842.52
Q 676.57 837.46 678.61 832.83
Q 678.67 832.71 678.56 832.80
Q 678.47 832.87 678.37 832.85
A 0.23 0.20 -66.5 0 1 678.26 832.51
Q 678.94 831.48 679.09 830.26
A 0.83 0.53 -88.1 0 1 679.56 829.58
L 679.96 829.50
Z"
/>
</svg>

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -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、tproxymixed。
- redirect仅重定向TCP。
- tproxy重定向TCP + UDP。
- mixed重定向TCPtun UDP。
### 更改代理模式
- BFM 使用 TPROXY 来透明代理 TCP + UDP默认。如果检测到设备不支持 TPROXY请打开/data/adb/box/settings.ini 并将 network_mode="redirect"更改为仅使用 TCP 代理的 redirect。
- 打开文件/data/adb/box/settings.ini network_mode 的值更改为 redirect、tproxymixed。
- redirect仅重定向 TCP。
- tproxy重定向 TCP + UDP。
- mixed重定向 TCPtun 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)

View File

@@ -137,4 +137,4 @@ The `BFM` service script is /data/adb/box/scripts/box.service
```
## CHANGELOG
[CHANGELOG](CHANGELOG.md)
[CHANGELOG](../CHANGELOG.md)

View File

@@ -138,4 +138,4 @@ Jika Anda ingin mengontrol `BFM` sepenuhnya dengan menjalankan perintah, buat sa
```
## CHANGELOG
[CHANGELOG](CHANGELOG.md)
[CHANGELOG](../CHANGELOG.md)