Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
twnesss committed Nov 24, 2023
1 parent 94104cc commit 3dfea58
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 433 deletions.
245 changes: 21 additions & 224 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Box for Magisk
# Box for Root (Magisk/KernelSU)

[![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)
[![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.svg" alt="BOX" width="200">
Expand All @@ -17,233 +17,30 @@

This project is a [Magisk](https://github.com/topjohnwu/Magisk) module which includes `clash`, `sing-box`, `v2ray` and `xray` proxies.

## Tun (tcp + udp)
## Apk Manager
BFR Manager [Download](https://github.com/taamarin/box.manager) optional
> note: notifications will appear continuously, to fix this open Magisk Manager, Click SuperUser, search BoxForRoot, disable logs and notifications
`open and edit /data/adb/box/settings.ini`
## Module Directory
MODDIR=/data/adb/box
MODLOG=/data/adb/box/run
SETTINGS=/data/adb/box/settings.ini
> notes: before editing the file **/data/adb/box/settings.ini**, make sure BFR is turned off
```shell
# select the client to use : clash / sing-box / xray / v2fly
bin_name="good day"
# Proxy mode: blacklist / whitelist / tun (only tun auto-route)
proxy_mode="tun" # change to tun
```

**sing-box config.json**

```json
"inbounds": [
{
"type": "tun",
"tag": "tun-in",
"interface_name": "utun",
"inet4_address": "172.19.0.1/30",
"inet6_address": "fdfe:dcba:9876::1/126",
"mtu": 9000,
"stack": "system", // lwip , gvisor
"auto_route": true,
"strict_route": false,
"sniff": true,
"sniff_override_destination": true,
"domain_strategy": "prefer_ipv4"
}
],
```

```json
"route": {
"final": "PROXY",
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
},
],
"auto_detect_interface": true // set true,
}
```

**clash config.yaml**

```yaml
tun:
enable: true
# 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]
```
## Manage service start / stop
The following core services are collectively referred to as BFR

## Mixed (redirec tcp + tun udp)
BFR service is auto-run after system boot up by default.
You can use Magisk/KernelSU Manager App to manage it. Starting the service may take a few seconds, stopping it may take effect immediately.

`open and edit /data/adb/box/settings.ini`
> notes: if it doesn't work you can use the command:
```bash
# start
su -c /data/adb/box/scripts/box.service start && su -c /data/adb/box/scripts/box.iptables enable

```shell
# select the client to use : clash / sing-box / xray / v2fly
bin_name="good day"
# set the port numbers for tproxy and redir
redir_port='9797'
# redirect: tcp only, / tproxy: for tcp+udp with tproxy, / mixed: mode with redirect[tcp] and tun[udp]
# Network mode: tproxy for transparent proxying
network_mode="mixed" # change to mixed
# Proxy mode: blacklist / whitelist / tun (only tun auto-route)
proxy_mode="blacklist"
# stop
su -c /data/adb/box/scripts/box.iptables disable && su -c /data/adb/box/scripts/box.service stop
```

**sing-box config.json**

```json
"inbounds": [
{
"type": "redirect",
"tag": "redirect-in",
"listen": "::",
"listen_port": 9797,
"sniff": true
},
{
"type": "tun",
"tag": "tun-in",
"interface_name": "utun",
"inet4_address": "43.0.0.1/30",
"inet6_address": "fdfe:dcba:9876::1/126",
"mtu": 9000,
"stack": "system", // lwip , gvisor
"auto_route": true,
"strict_route": false,
"sniff": true,
"sniff_override_destination": true,
"domain_strategy": "prefer_ipv4"
}
]
```

```json
"route": {
"final": "PROXY",
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
},
],
"auto_detect_interface": true // set true,
}
```

**clash config.yaml**

```yaml
redir-port: 9797
tun:
enable: true
# 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]
```

## Tproxy (tcp + tun)

`open and edit /data/adb/box/settings.ini`

```shell
# select the client to use : clash / sing-box / xray / v2fly
bin_name="good day"
# set the port numbers for tproxy and redir
tproxy_port='9898'
# redirect: tcp only, / tproxy: for tcp+udp with tproxy, / mixed: mode with redirect[tcp] and tun[udp]
# Network mode: tproxy for transparent proxying
network_mode="tproxy" # change to tproxy
# Proxy mode: blacklist / whitelist / tun (only tun auto-route)
proxy_mode="blacklist"
```

**sing-box config.json**

```json
"inbounds": [
{
"type": "tproxy",
"tag": "tproxy-in",
"listen": "::",
"listen_port": 9898,
"sniff": true,
"sniff_override_destination": true,
"sniff_timeout": "300ms",
"domain_strategy": "prefer_ipv4",
"udp_timeout": 300
}
]
```

**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]
```

**xray/v2ray config.json**

```json
"inbounds": [
{
"tag": "proxy-in",
"port": 9898,
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy"
}
},
"sniffing": {
"enabled": true,
"routeOnly": true,
"destOverride": [
"http",
"tls"
]
}
}
]
```

#### 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)
Loading

0 comments on commit 3dfea58

Please sign in to comment.