forked from taamarin/ClashforMagisk
-
Notifications
You must be signed in to change notification settings - Fork 2
/
clash.config
executable file
·159 lines (140 loc) · 5.17 KB
/
clash.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/system/bin/sh
# busybox path
now=$(date +"%I.%M %p")
busybox_path="/data/clash/tools/busybox"
ipv6=$(grep "ipv6" /data/clash/template | ${busybox_path} awk -F ': ' '{print $2}' | head -1)
run_usage="false"
# display usage res cpu in loh
mark_id="2022"
# blacklist / whitelist, or / core [only tun]
mode="blacklist"
network_mode="UDP"
# TCP: REDIRECT / UDP: TPROXY / MIXED: TCP + TUN
# ap_list=("softap+" "wlan+" "swlan+" "ap+" "rndis+")
# untuk info AP type ifconfig di terminal
ap_list=("softap+" "wlan+" "swlan+" "ap+" "rndis+")
ignore_out_list=()
# ap list
port_detect="true"
# detected port
use_premium="false"
# select meta or premium
update_interval="0 00 * * *"
# set interval update, info: https://crontab.guru/
auto_updateSubcript="false"
# setting auto update subcript
Subcript_url="link url"
# url langganan config
config_online="false"
# download langganan/config
if [ "${use_premium}" = "true" ] ; then
tun_device="utun"
else
tun_device=$(grep "device" /data/clash/template | ${busybox_path} awk -F ': ' '{print $2}')
fi
# tun device
Cgroup_memory="false"
Cgroup_memory_path=""
Cgroup_memory_limit="50M"
# cgroup untuk membatasi penggunaan memori
Clash_bin_name="clash"
Clash_data_dir="/data/clash"
# directory clash & file
Clash_template="${Clash_data_dir}/template"
# directory template
Clash_run_path="${Clash_data_dir}/run"
CFM_logs_file="${Clash_run_path}/run.logs"
Clash_pid_file="${Clash_run_path}/clash.pid"
Clash_bin="${Clash_data_dir}/kernel"
Clash_lib="${Clash_bin}/lib"
Clash_bin_path="${Clash_bin}/${Clash_bin_name}"
Clash_Premium="${Clash_lib}/clash.premium"
Clash_Meta="${Clash_lib}/clash.meta"
Clash_scripts_dir="${Clash_data_dir}/scripts"
appuid_file="${Clash_run_path}/appuid.list"
filter_packages_file="${Clash_data_dir}/packages.list"
system_packages_file="/data/system/packages.list"
# directory lservice
use_config="false"
if [ "${use_config}" == "false" ] ; then
Clash_config_file="${Clash_data_dir}/config.yaml"
else
Clash_config_file="${Clash_data_dir}/assets/${use_config}"
fi
temporary_config_file="${Clash_run_path}/config.yaml"
# custom config.yaml
schedule_update_core="false"
url_meta="https://github.com/MetaCubeX/Clash.Meta/releases"
url_premium="https://github.com/Dreamacro/clash/releases"
arm=$(uname -m)
if [ "${use_premium}" == "false" ] ; then
file_kernel="clash.meta"
meta_alpha="true"
tag="Prerelease-Alpha"
tag_name="alpha-[0-9,a-z]+"
if [ ${arm} == "aarch64" ] ; then
platform="android"
arch="arm64"
else
platform="linux"
arch="armv7"
fi
else
file_kernel="clash.premium"
platform="linux"
if [ ${arm} == "aarch64" ] ; then
arch="arm64"
else
arch="armv7"
fi
fi
auto_updateGeoX="false"
Clash_geodata_mode=$(grep "geodata-mode" ${Clash_template} | ${busybox_path} awk -F ': ' '{print $2}')
if [ "${use_premium}" == "true" ] ; then
Clash_GeoIP_file="${Clash_data_dir}/Country.mmdb"
GeoIP_dat_url="https://github.com/Loyalsoldier/geoip/raw/release/Country.mmdb"
else
Clash_GeoIP_file="${Clash_data_dir}/GeoIP.dat"
GeoIP_dat_url="https://github.com/v2fly/geoip/raw/release/geoip-only-cn-private.dat"
fi
Clash_GeoSite_file="${Clash_data_dir}/GeoSite.dat"
GeoSite_url="https://github.com/CHIZI-0618/v2ray-rules-dat/raw/release/geosite.dat"
iptables_version=$(iptables -V | grep -o "v1\.[0-9]")
if [ "${iptables_version}" = "v1.6" ] || [ "${iptables_version}" = "v1.8" ] ; then
iptables_wait="iptables -w 100"
ip6tables_wait="ip6tables -w 100"
else
export ANDROID_DATA=/data
export ANDROID_ROOT=/system
iptables_wait="iptables"
ip6tables_wait="ip6tables"
fi
# tproxy-port
Clash_tproxy_port=$(grep "tproxy-port" ${Clash_template} | ${busybox_path} awk -F ': ' '{print $2}')
Clash_redir_port=$(grep "redir-port" ${Clash_template} | ${busybox_path} awk -F ': ' '{print $2}')
# dns
Clash_dns_port=$(grep "listen" ${Clash_template} | ${busybox_path} awk -F ':' '{print $3}')
# tun status
Clash_tun_status=$(${busybox_path} awk -F ': ' '/^tun: *$/{getline; print $2}' ${Clash_template})
Clash_stack_mode=$(grep "stack" ${Clash_template} | ${busybox_path} awk -F ': ' '{print $2}')
Clash_tcp_concurrent=$(grep "tcp-concurrent" ${Clash_template} | ${busybox_path} awk -F ':' '{print $2}')
Clash_enhanced_mode=$(grep "enhanced-mode" ${Clash_template} | ${busybox_path} awk -F ': ' '{print $2}')
Clash_fake_ip_range=$(grep "fake-ip-range" ${Clash_template} | ${busybox_path} awk -F ': ' '{print $2}')
# v2dns, 0 is v2dns off, 1 is v2dns on
# create akun v2dns di whyvpn ,
dnstt_bin_name="dnstt-client"
dnstt_client_bin="${Clash_bin}/${dnstt_bin_name}"
run_dnstt="0"
dns_for_dnstt="1.1.1.1"
pubkey=""
nsdomain=""
reserved_ip=(0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.0.0.0/24 192.0.2.0/24 192.88.99.0/24 192.168.0.0/16 198.51.100.0/24 203.0.113.0/24 224.0.0.0/4 240.0.0.0/4 255.255.255.255/32)
reserved_ip6=(::/128 ::1/128 ::ffff:0:0/96 100::/64 64:ff9b::/96 2001::/32 2001:10::/28 2001:20::/28 2001:db8::/32 2002::/16 fc00::/7 fe80::/10 ff00::/8)
log() {
export TZ=Asia/Jakarta
echo "${now} $*" | tee -a ${CFM_logs_file} >> /dev/null 2>&1
}
logs() {
export TZ=Asia/Jakarta
echo -n "${now} $*" | tee -a ${CFM_logs_file} >> /dev/null 2>&1
}