Skip to content

rockxsj/box_for_magisk

 
 

Repository files navigation

Box for Magisk

id en cn

BOX
BOX

Transparent Proxy for Android(root)

android releases

This project is a Magisk module which includes clash, sing-box, v2ray and xray proxies.

Tun (tcp + udp)

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

# 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

  "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"
    }
  ],
  "route": {
    "final": "PROXY",
    "rules": [
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
    ],
    "auto_detect_interface": true // set true, 
  }

clash config.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]

Mixed (redirec tcp + tun udp)

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

# 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"

sing-box config.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"
    }
  ]
  "route": {
    "final": "PROXY",
    "rules": [
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
    ],
    "auto_detect_interface": true // set true, 
  }

clash config.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

# 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

  "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

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

  "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

About

Transparent Proxy for Android(root)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%