Skip to content

Commit c025ede

Browse files
committed
Suport KernelSU
1 parent 6daa7c9 commit c025ede

18 files changed

+42
-90
lines changed

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ jobs:
1919
uses: softprops/action-gh-release@v1
2020
with:
2121
tag_name: ${{ github.ref_name }}
22-
files: Clash_for_Magisk-v*.zip
22+
files: Clash_for_KernelSU-v*.zip
2323
generate_release_notes: true

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Clash_for_KernelSU-v3.0.zip
2+
.DS_Store

META-INF/com/google/android/update-binary

-33
This file was deleted.

META-INF/com/google/android/updater-script

-1
This file was deleted.

README.md

+20-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Clash for Magisk
1+
# Clash for KernelSU
22
<h1 align="center">
3-
<img src="https://github.com/taamarin/ClashforMagisk/blob/master/docs/logo.png" alt="Clash" width="200">
3+
<img src="https://github.com/Dreamail/ClashforKernelSU/blob/master/docs/logo.png" alt="Clash" width="200">
44
<br>Clash<br>
55
</h1>
66
<h4 align="center">Proxy Transparan for android.</h4>
@@ -9,27 +9,24 @@
99
<div align="center">
1010

1111
[![ANDROID](https://img.shields.io/badge/Android-3DDC84?style=for-the-badge&logo=android&logoColor=white)]()
12-
[![RELEASES](https://img.shields.io/github/downloads/taamarin/ClashforMagisk/total.svg?style=for-the-badge)](https://github.com/taamarin/ClashforMagisk/releases)
13-
[![TELEGRAM CHANNEL](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/nothing_taamarin)
14-
[![TELEGRAM](https://img.shields.io/badge/Telegram%20-Grups%20-blue?style=for-the-badge)](https://t.me/taamarin)
15-
[![MAGISK](https://img.shields.io/badge/Magisk%20-v20.4+-brightgreen?style=for-the-badge)](https://github.com/topjohnwu/Magisk)
12+
[![RELEASES](https://img.shields.io/github/downloads/Dreamail/ClashforKernelSU/total.svg?style=for-the-badge)](https://github.com/Dreamail/ClashforKernelSU/releases)
1613
[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=for-the-badge)](https://android-arsenal.com/api?level=19)
17-
<a href="https://github.com/taamarin/ClashforMagisk/releases">
18-
<img src="https://img.shields.io/github/release/taamarin/ClashforMagisk/all.svg?style=for-the-badge">
14+
<a href="https://github.com/Dreamail/ClashforKernelSU/releases">
15+
<img src="https://img.shields.io/github/release/Dreamail/ClashforKernelSU/all.svg?style=for-the-badge">
1916
</a>
2017

2118
</div>
2219

23-
A fork of [ClashForMagisk](https://github.com/kalasutra/Clash_For_Magisk)
20+
A fork of [ClashForMagisk](https://github.com/taamarin/ClashforMagisk)
2421

25-
This is a Clash module for Magisk, and includes binaries for arm, arm64, x86, x64.
22+
This is a Clash module for KernelSU, and includes binaries for arm, arm64.
2623

27-
## Manager Apps CFM
24+
## Manager Apps
2825
- [ClashForMagisk_Manager](https://t.me/taamarin/26137) EN
2926
- [ClashForMagisk_Manager](https://t.me/MagiskChangeKing/159) CN
3027

3128
## Install
32-
You can download the release [installer zip](https://github.com/taamarin/ClashforMagisk/releases) file and install it via the Magisk Manager App.
29+
You can download the release [installer zip](https://github.com/Dreamail/ClashforKernelSU/releases) file and install it via the KernelSU manager App.
3330

3431
#### Config
3532
- Clash config files `/data/clash/*`
@@ -43,26 +40,26 @@ You can download the release [installer zip](https://github.com/taamarin/Clashfo
4340
### Normal usage ( Default and Recommended )
4441
##### Manage service start / stop
4542
- Clash service is auto-run after system boot up by default.
46-
- You can use Magisk Manager App to manage it. Be patient to wait it take effect (about 3 second).
43+
- You can use KernelSU manager App to manage it. Be patient to wait it take effect (about 3 second).
4744

4845
### Advanced usage
4946
> MODDIR= "/data/clash"
5047
5148
##### Change proxy mode
5249
- Clash uses `TPROXY` transparent proxy `TCP + UDP` by default, if it detects that the device does not support `TPROXY`, it will automatically use `REDIRECT` to proxy only `TCP`
5350

54-
- Open `${MODDIR}/scripts/clash.config` file line [17-18](https://github.com/taamarin/ClashforMagisk/blob/master/scripts/clash.config#L17-#L18), modify the value of `network_mode` to `TCP` or `MIXED `to use `REDIRECT` to proxy `TCP`, and `UDP` will not be proxied when `TUN` is not enabled in the Clash kernel
51+
- Open `${MODDIR}/scripts/clash.config` file line [17-18](https://github.com/Dreamail/ClashforKernelSU/blob/master/scripts/clash.config#L17-#L18), modify the value of `network_mode` to `TCP` or `MIXED `to use `REDIRECT` to proxy `TCP`, and `UDP` will not be proxied when `TUN` is not enabled in the Clash kernel
5552

5653
##### Bypass transparent proxy when connected to Wi-Fi or open a hotspot
57-
Clash default transparent proxy local and hotspot, line [20-23](https://github.com/taamarin/ClashforMagisk/blob/master/scripts/clash.config#L20-#L23)
54+
Clash default transparent proxy local and hotspot, line [20-23](https://github.com/Dreamail/ClashforKernelSU/blob/master/scripts/clash.config#L20-#L23)
5855

5956
- Open the `${MODDIR}/scripts/clash.config` file, modify the `ignore_out_list` array and add the `wlan+` element, the transparent proxy will `bypass` the `WLAN`, and the hotspot will not be affected
6057

6158
- Open the `${MODDIR}/scripts/clash.config` file, modify the ap_list array and delete the `wlan+` element to opaque proxy `WLAN` and hotspot (the `MediaTek` model may be `ap+` instead of `wlan+`)
6259

6360
##### Select which packages to proxy
6461
- If you expect all Apps proxy by Clash with transparent proxy EXCEPT specific Apps, write down bypass at the first line then these Apps' packages separated as above in file `/data/clash/packages.list`
65-
- clash.config line [14-15](https://github.com/taamarin/ClashforMagisk/blob/master/scripts/clash.config#L14-#L15)
62+
- clash.config line [14-15](https://github.com/Dreamail/ClashforKernelSU/blob/master/scripts/clash.config#L14-#L15)
6663
- `blacklist` & `whitelits`, not working on `fake-ip`
6764

6865
- dns:
@@ -87,7 +84,7 @@ Clash default transparent proxy local and hotspot, line [20-23](https://github.c
8784
8885
##### subscription
8986
you can use SubScription
90-
- open `/data/clash/clash.config` line [30-35](https://github.com/taamarin/ClashforMagisk/blob/master/scripts/clash.config#L30-#L35)
87+
- open `/data/clash/clash.config` line [30-35](https://github.com/Dreamail/ClashforKernelSU/blob/master/scripts/clash.config#L30-#L35)
9188
- update_interval="interval contab"
9289
- Subcript_url="your_link"
9390
- auto_updateSubcript="true"
@@ -98,7 +95,7 @@ ${MODDIR}/scripts/clash.tool -s
9895
```
9996

10097
##### Config Online
101-
- **clash.config** line [37-38](https://github.com/taamarin/ClashforMagisk/blob/master/scripts/clash.config#L37-#L38), If true,
98+
- **clash.config** line [37-38](https://github.com/Dreamail/ClashforKernelSU/blob/master/scripts/clash.config#L37-#L38), If true,
10299
- use it to download the subscription configuration, when starting Clash , So no need to type `${MODDIR}/scripts/clash.tool -s` anymore
103100

104101
##### Change Clash kernel
@@ -108,28 +105,26 @@ You can use Clash.Premium and Clash.Meta
108105
- Clash Premium
109106
- `/data/clash/kernel/lib/Clash.Premium`
110107

111-
you can download the Kernel automatically, for the settings in the **clash.config** line [85-109](https://github.com/taamarin/ClashforMagisk/blob/master/scripts/clash.config#L85-#L109)
108+
you can download the Kernel automatically, for the settings in the **clash.config** line [85-109](https://github.com/Dreamail/ClashforKernelSU/blob/master/scripts/clash.config#L85-#L109)
112109
```shell
113110
${MODDIR}/scripts/clash.tool -k
114111
```
115112

116113
##### GeoSite, GeoIP, and Mmdb
117-
- settings are in clash.config line [111-135](https://github.com/taamarin/ClashforMagisk/blob/master/scripts/clash.config#L111-#L135)
114+
- settings are in clash.config line [111-135](https://github.com/Dreamail/ClashforKernelSU/blob/master/scripts/clash.config#L111-#L135)
118115
- if true, will be updated every day at 00.00
119116
- you can change the URL
120117

121118
## Uninstall
122-
- Uninstall the module via Magisk Manager App.
119+
- Uninstall the module via KernelSU manager App.
123120
- You can clean Clash data dir by running command
124121
```shell
125-
rm -rf /data/clash && rm -rf /data/adb/service.d/clash_service.sh
122+
rm -rf /data/clash
126123
```
127124

128-
## Tutorial Clash For Magisk
129-
> Tutorial [Tap Here](https://telegra.ph/%F0%9D%93%92%F0%9D%93%B5%F0%9D%93%AA%F0%9D%93%BC%F0%9D%93%B1%F0%9D%93%95%F0%9D%93%B8%F0%9D%93%BB%F0%9D%93%9C%F0%9D%93%AA%F0%9D%93%B0%F0%9D%93%B2%F0%9D%93%BC%F0%9D%93%B4-11-28)
130-
131125
## Credits
132126
This is a repo fork
127+
- [taamarin/ClashforMagisk](https://github.com/taamarin/ClashforMagisk)
133128
- [kalasutra/Clash_for_magisk](https://github.com/kalasutra/Clash_For_Magisk)
134129
- [CHIZI-0618/box4magisk](https://github.com/CHIZI-0618/box4magisk)
135130
- [Asterisk4Magisk/Xray4Magisk](https://github.com/Asterisk4Magisk/Xray4Magisk)

binary/arm.tar.bz2

910 KB
Binary file not shown.

binary/arm64.tar.bz2

1.03 MB
Binary file not shown.

binary/x64.tar.bz2

-1.73 MB
Binary file not shown.

binary/x86.tar.bz2

-1.48 MB
Binary file not shown.

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
zip -r -o -X -ll Clash_for_Magisk-$(cat module.prop | grep 'version=' | awk -F '=' '{print $2}').zip ./ -x '.git/*' -x 'build.sh' -x 'docs/*' -x 'CHANGELOG.md' -x 'README.md' -x 'update.json' -x '.github/*'
3+
zip -r -o -X -ll Clash_for_KernelSU-$(cat module.prop | grep 'version=' | awk -F '=' '{print $2}').zip ./ -x '.git/*' -x 'build.sh' -x 'docs/*' -x 'CHANGELOG.md' -x 'README.md' -x 'update.json' -x '.github/*'

customize.sh

+7-15
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,24 @@ architecture=""
66
uid="0"
77
gid="3005"
88
clash_data_dir="/data/clash"
9-
modules_dir="/data/adb/modules"
9+
modules_dir="/data/adb/ksu/modules"
1010
bin_path="/system/bin/"
1111
dns_path="/system/etc"
12-
clash_adb_dir="/data/adb"
13-
clash_service_dir="/data/adb/service.d"
14-
busybox_data_dir="/data/adb/magisk/busybox"
1512
ca_path="${dns_path}/security/cacerts"
1613
clash_data_dir_kernel="${clash_data_dir}/kernel"
14+
clash_data_dir_tools="${clash_data_dir}/tools"
1715
clash_data_sc="${clash_data_dir}/scripts"
1816
mod_config="${clash_data_sc}/clash.config"
1917
yacd_dir="${clash_data_dir}/dashboard"
2018
latest=$(date +%Y%m%d%H%M)
2119

2220
if [ $BOOTMODE ! = true ] ; then
2321
ui_print "- Installing through TWRP Not supported"
24-
ui_print "- Intsall this module via Magisk Manager"
22+
ui_print "- Intsall this module via KernelSU manager"
2523
abort "- ! Aborting installation !"
2624
fi
2725

28-
ui_print "- Installing Clash for Magisk"
26+
ui_print "- Installing Clash for KernelSU"
2927

3028
if [ -d "${clash_data_dir}" ] ; then
3129
ui_print "- Backup Clash"
@@ -41,6 +39,7 @@ fi
4139
ui_print "- Create folder Clash."
4240
mkdir -p ${clash_data_dir}
4341
mkdir -p ${clash_data_dir_kernel}
42+
mkdir -p ${clash_data_dir_tools}
4443
mkdir -p ${MODPATH}${ca_path}
4544
mkdir -p ${clash_data_dir}/dashboard
4645
mkdir -p ${MODPATH}/system/bin
@@ -77,11 +76,6 @@ ui_print "- Move Cert&Geo"
7776
mv ${clash_data_dir}/scripts/cacert.pem ${MODPATH}${ca_path}
7877
mv ${MODPATH}/geo/* ${clash_data_dir}/
7978

80-
if [ ! -d /data/adb/service.d ] ; then
81-
ui_print "- Make folder service"
82-
mkdir -p /data/adb/service.d
83-
fi
84-
8579
ui_print "- Create resolv.conf"
8680
if [ ! -f "${dns_path}/resolv.conf" ] ; then
8781
touch ${MODPATH}${dns_path}/resolv.conf
@@ -98,7 +92,6 @@ fi
9892

9993
unzip -j -o "${ZIPFILE}" 'service.sh' -d ${MODPATH} >&2
10094
unzip -j -o "${ZIPFILE}" 'uninstall.sh' -d ${MODPATH} >&2
101-
unzip -j -o "${ZIPFILE}" 'clash_service.sh' -d ${clash_service_dir} >&2
10295

10396
ui_print "- Extract binary-$ARCH "
10497
tar -xjf ${MODPATH}/binary/${ARCH}.tar.bz2 -C ${clash_data_dir_kernel}/&& echo "- extar kernel Succes" || echo "- extar kernel gagal"
@@ -109,6 +102,7 @@ mv ${clash_data_dir}/scripts/clash.config ${clash_data_dir}/
109102
mv ${clash_data_dir}/scripts/mosdns ${clash_data_dir}/
110103
mv ${clash_data_dir}/mosdns/mosdns ${clash_data_dir_kernel}/
111104
mv ${clash_data_dir}/mosdns/dnstt-client ${clash_data_dir_kernel}/
105+
mv ${clash_data_dir_kernel}/busybox ${clash_data_dir_tools}/
112106

113107
if [ ! -f "${bin_path}/ss" ] ; then
114108
mv ${clash_data_dir_kernel}/ss ${MODPATH}${bin_path}/
@@ -120,15 +114,13 @@ rm -rf ${MODPATH}/dashboard.zip
120114
rm -rf ${MODPATH}/scripts
121115
rm -rf ${MODPATH}/geo
122116
rm -rf ${MODPATH}/binary
123-
rm -rf ${MODPATH}/clash_service.sh
124117
rm -rf ${clash_data_dir}/scripts/config.yaml
125118
rm -rf ${clash_data_dir_kernel}/curl
126119

127120
sleep 1
128121

129122
ui_print "- Set Permissons"
130123
set_perm_recursive ${MODPATH} 0 0 0755 0644
131-
set_perm_recursive ${clash_service_dir} 0 0 0755 0755
132124
set_perm_recursive ${clash_data_dir} ${uid} ${gid} 0755 0644
133125
set_perm_recursive ${clash_data_dir}/scripts ${uid} ${gid} 0755 0755
134126
set_perm_recursive ${clash_data_dir}/kernel ${uid} ${gid} 0755 0755
@@ -152,6 +144,6 @@ set_perm ${clash_data_dir}/scripts/usage.sh 0 0 0755
152144
set_perm ${clash_data_dir}/clash.config ${uid} ${gid} 0755
153145
set_perm ${clash_data_dir}/kernel/mosdns 0 0 0755
154146
set_perm ${clash_data_dir}/kernel/dnstt-client 0 0 0755
155-
set_perm ${clash_service_dir}/clash_service.sh 0 0 0755
147+
set_perm ${clash_data_dir}/tools/busybox 0 0 0755
156148
sleep 1
157149
ui_print "- Installation is complete, reboot your device"

module.prop

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
id=ClashForMagisk
2-
name=Clash for Magisk
1+
id=ClashForKernelSU
2+
name=Clash for KernelSU
33
version=v2.5.1
44
versionCode=20221201
5-
author=t🌸amarin
5+
author=t🌸amarin,Dreamail
66
description= Use iptables to support Clash's transparent proxy. Hey, damn half-crippled Android!!!
7-
updateJson=https://github.com/taamarin/ClashforMagisk/raw/master/update.json
7+
#updateJson=https://github.com/taamarin/ClashforMagisk/raw/master/update.json

scripts/clash.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/system/bin/sh
22

33
# busybox path
4-
busybox_path="/data/adb/magisk/busybox"
4+
busybox_path="/data/clash/tools/busybox"
55
ipv6=$(grep "ipv6" /data/clash/template | ${busybox_path} awk -F ': ' '{print $2}' | head -1)
66

77
run_usage="false"

scripts/clash.service

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ start_clash() {
189189
replace_kernel
190190
echo $(date) > $CFM_logs_file
191191
echo "$(${Clash_bin_path} -v)" >> $CFM_logs_file
192-
echo "Clash for Magisk v2.5.1" > /dev/null
192+
echo "Clash for KernelSU v2.5.1" > /dev/null
193193
echo "CPU: % | RES: kb" >> $CFM_logs_file
194194
echo "━━━━━━━━━━━━━━━━━━━━━━━━━" >> $CFM_logs_file
195195
if [ "${ipv6}" = "false" ] ; then

scripts/start.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
#!/system/bin/sh
22

3-
moddir="/data/adb/modules/ClashForMagisk"
4-
if [ -n "$(magisk -v | grep lite)" ]
5-
then
6-
moddir=/data/adb/lite_modules/ClashForMagisk
7-
fi
3+
moddir="/data/adb/ksu/modules/ClashForKernelSU"
84

95
scripts_dir="/data/clash/scripts"
10-
busybox_path="/data/adb/magisk/busybox"
6+
busybox_path="/data/clash/tools/busybox"
117
Clash_run_path="/data/clash/run"
128
Clash_pid_file="${Clash_run_path}/clash.pid"
139

scripts/usage.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/system/bin/sh
22

3+
busybox_path="/data/clash/tools/busybox"
4+
35
getmemory(){
46
clash_pid=$(cat /data/clash/run/clash.pid)
5-
clash_alive=$(grep VmRSS /proc/${clash_pid}/status | /data/adb/magisk/busybox awk -F':' '{print $2}' | /data/adb/magisk/busybox awk '{print $1}')
7+
clash_alive=$(grep VmRSS /proc/${clash_pid}/status | ${busybox_path} awk -F':' '{print $2}' | ${busybox_path} awk '{print $1}')
68
if [ ${clash_alive} -ge 1024 ]
79
then
810
clash_res="$(expr ${clash_alive} / 1024)Mb"

clash_service.sh service.sh

File renamed without changes.

uninstall.sh

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ Clash_data_dir="/data/clash"
22

33
rm_data() {
44
rm -rf ${Clash_data_dir}
5-
rm -rf /data/adb/service.d/clash_service.sh
65
}
76

87
rm_data

0 commit comments

Comments
 (0)