Skip to content

Commit

Permalink
Change proxy_mode=tun -> network_mode=tun
Browse files Browse the repository at this point in the history
— Add network_mode=enhance
— Adjust iptables version
— Delete Taskset
— Misc
  • Loading branch information
twnesss committed Mar 21, 2024
1 parent 5ffac72 commit 71aaf9b
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 224 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# These are supported funding model platforms

github: ['taamarin']
custom: ['https://sociabuzz.com/taamarin', 'https://saweria.co/taamarin']
custom: ['https://paypal.me/MJuwanda02']
4 changes: 2 additions & 2 deletions .github/taamarinbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
{commit}
[Github](https://github.com/taamarin/box_for_root)
[Github](https://github.com/taamarin/box_for_magisk)
[Releases](https://github.com/taamarin/box_for_magisk/releases)
#module #ksu #magisk #bfr #debug
#module #ksu #apatch #magisk #bfr #debug
""".strip()

def get_caption():
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
if: ${{ success() }}
env:
CHAT_ID: "-1001597117128"
MESSAGE_THREAD_ID: "218356"
MESSAGE_THREAD_ID: "282263"
API_ID: ${{ secrets.API_ID }}
API_HASH: ${{ secrets.API_HASH }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
Expand Down
240 changes: 137 additions & 103 deletions box/scripts/box.iptables

Large diffs are not rendered by default.

183 changes: 94 additions & 89 deletions box/scripts/box.service

Large diffs are not rendered by default.

43 changes: 27 additions & 16 deletions box/scripts/box.tool
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ upsubs() {
enhanced=false
update_file_name="${clash_config}"
if [ "${renew}" != "true" ]; then
yq_command="yq"
yq="yq"
if ! command -v yq &>/dev/null; then
if [ ! -e "${box_dir}/bin/yq" ]; then
log Debug "yq file not found, start to download from github"
${scripts_dir}/box.tool upyq
fi
yq_command="${box_dir}/bin/yq"
yq="${box_dir}/bin/yq"
fi
enhanced=true
update_file_name="${update_file_name}.subscription"
Expand All @@ -277,16 +277,16 @@ upsubs() {
log Info "${update_file_name} saved"
# If there is a yq command, extract the proxy information from the yml and output it to the clash_provide_config file
if [ "${enhanced}" = "true" ]; then
if ${yq_command} '.proxies' "${update_file_name}" >/dev/null 2>&1; then
"${yq_command}" '.proxies' "${update_file_name}" > "${clash_provide_config}"
"${yq_command}" -i '{"proxies": .}' "${clash_provide_config}"
if ${yq} '.proxies' "${update_file_name}" >/dev/null 2>&1; then
${yq} '.proxies' "${update_file_name}" > "${clash_provide_config}"
${yq} -i '{"proxies": .}' "${clash_provide_config}"

if [ "${custom_rules_subs}" = "true" ]; then
if ${yq_command} '.rules' "${update_file_name}" >/dev/null 2>&1; then
if ${yq} '.rules' "${update_file_name}" >/dev/null 2>&1; then

"${yq_command}" '.rules' "${update_file_name}" > "${clash_provide_rules}"
"${yq_command}" -i '{"rules": .}' "${clash_provide_rules}"
"${yq_command}" -i 'del(.rules)' "${clash_config}"
${yq} '.rules' "${update_file_name}" > "${clash_provide_rules}"
${yq} -i '{"rules": .}' "${clash_provide_rules}"
${yq} -i 'del(.rules)' "${clash_config}"

cat "${clash_provide_rules}" >> "${clash_config}"
fi
Expand Down Expand Up @@ -634,6 +634,18 @@ cgroup_cpuset() {
ip_port=$(if [ "${bin_name}" = "clash" ]; then busybox awk '/external-controller:/ {print $2}' "${clash_config}"; else find /data/adb/box/sing-box/ -maxdepth 1 -type f -name "*.json" -exec busybox awk -F':' '/experimental/,/\}/' {} \; | sed -n 's/.*"external_controller": "\(.*\)",/\1/p'; fi;)
secret=""

bond1() {
su -mm -c "cmd wifi force-low-latency-mode enabled"
su -mm -c "sysctl -w net.ipv4.tcp_low_latency=1"
su -mm -c "ip link set dev wlan0 txqueuelen 4000"
}

bond0() {
su -mm -c "cmd wifi force-low-latency-mode disabled"
su -mm -c "sysctl -w net.ipv4.tcp_low_latency=0"
su -mm -c "ip link set dev wlan0 txqueuelen 3000"
}

case "$1" in
check)
check
Expand All @@ -655,13 +667,14 @@ case "$1" in
;;
esac
;;
bond0|bond1)
$1
;;
geosub)
upsubs
upgeox
if [ -f "${box_pid}" ]; then
if kill -0 "$(<"${box_pid}" 2>/dev/null)"; then
reload
fi
kill -0 "$(<"${box_pid}" 2>/dev/null)" && reload
fi
;;
geox|subs)
Expand All @@ -672,9 +685,7 @@ case "$1" in
[ "${bin_name}" != "clash" ] && exit 1
fi
if [ -f "${box_pid}" ]; then
if kill -0 "$(<"${box_pid}" 2>/dev/null)"; then
reload
fi
kill -0 "$(<"${box_pid}" 2>/dev/null)" && reload
fi
;;
upkernel)
Expand All @@ -701,6 +712,6 @@ case "$1" in
;;
*)
echo "${red}$0 $1 no found${normal}"
echo "${yellow}usage${normal}: ${green}$0${normal} {${yellow}check|memcg|cpuset|blkio|geosub|geox|subs|upkernel|upxui|upyq|upcurl|reload|all${normal}}"
echo "${yellow}usage${normal}: ${green}$0${normal} {${yellow}check|memcg|cpuset|blkio|geosub|geox|subs|upkernel|upxui|upyq|upcurl|reload|bond0|bond1|all${normal}}"
;;
esac
12 changes: 6 additions & 6 deletions box/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ bin_name="clash"
# This script is used to set the user and group for the BFM core files.
box_user_group="root:net_admin"

# redirect: tcp only,
# tproxy: for tcp + udp with tproxy,
# mixed: mode with redirect[tcp] + tun[udp]
# redirect: tcp + udp[direct]
# tproxy: tcp + udp
# mixed: redirect[tcp] + tun[udp]
# enhance: redirect[tcp] + tproxy[udp]
# tun: tcp + udp (auto-route)
network_mode="tproxy"

# blacklist / whitelist / tun (only tun auto-route)
# blacklist / whitelist
proxy_mode="blacklist"

# list of package names to be proxied
Expand All @@ -58,8 +60,6 @@ memcg_limit="25M"

# Set cgroup to cpuset usage
cgroup_cpuset="false"
# 0f=0-3 / f0=4-7 / ff=0-7, recommended default: ff
mask_cpuset="ff"

# Set cgroup to blkio usage
cgroup_blkio="false"
Expand Down
12 changes: 6 additions & 6 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ elif [ "$KSU" = true ] && [ "$KSU_VER_CODE" -lt 10670 ]; then
abort "-----------------------------------------------------------"
fi

if [ "$API" -lt 28 ]; then
ui_print "! Unsupported sdk: $API"
abort "! Minimal supported sdk is 28 (Android 9)"
else
ui_print "- Device sdk: $API"
fi
# if [ "$API" -lt 28 ]; then
# ui_print "! Unsupported sdk: $API"
# abort "! Minimal supported sdk is 28 (Android 9)"
# else
# ui_print "- Device sdk: $API"
# fi

service_dir="/data/adb/service.d"
if [ "$KSU" = "true" ]; then
Expand Down

0 comments on commit 71aaf9b

Please sign in to comment.