Skip to content
This repository was archived by the owner on Feb 28, 2023. It is now read-only.

Commit 69f46a4

Browse files
committed
update scripts
1 parent 81bba17 commit 69f46a4

4 files changed

Lines changed: 62 additions & 31 deletions

File tree

scripts/clash.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mode="blacklist"
1111
info_core="true"
1212
nat_kernel="false"
1313
use_premium=false
14-
use_config=false
14+
use_config="false"
1515

1616
# CGROUP untuk membatasi penggunaan memori,
1717
Cgroup_memory="false"
@@ -82,8 +82,8 @@ Clash_redir_port=$(grep "redir-port" ${Clash_dns} | ${busybox_path} awk -F ':' '
8282
Clash_mixed_port=$(grep "mixed-port" ${Clash_dns} | ${busybox_path} awk -F ':' '{print $2}')
8383
Clash_dns_port=$(grep "listen" ${Clash_dns} | ${busybox_path} awk -F ':' '{print $3}')
8484
Clash_enhanced_mode=$(grep "enhanced-mode" ${Clash_dns} | ${busybox_path} awk -F ': ' '{print $2}')
85-
Clash_tun_status=$(${busybox_path} awk -F ': ' '/^tun: *$/{getline; print $2}' ${Clash_dns})
8685
tun_device=$(${busybox_path} awk -F ': ' '/ +device: /{print $2}' ${Clash_dns})
86+
auto_iptables=$(${busybox_path} awk -F ': ' '/^iptables: *$/{getline; print $2}' ${Clash_dns})
8787
interface_name=$(ip r show | grep "src" | cut -d " " -f 3,12)
8888

8989
# internet ipv4

scripts/clash.service

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ scripts=`realpath $0`
44
scripts_dir=`dirname ${scripts}`
55
. ${scripts_dir}/clash.config
66

7-
echo -n "" > ${CFM_logs_file}
8-
${Clash_bin_path} -v >> ${CFM_logs_file}
9-
echo "${date_day}" >> ${CFM_logs_file}
10-
echo "Clash for Magisk v1.9.5" >> ${CFM_logs_file}
11-
127
start_clash() {
138
if [ "${ipv6}" = "false" ] ; then
149
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
@@ -22,6 +17,11 @@ start_clash() {
2217
echo 0 > /proc/sys/net/ipv6/conf/lo/disable_ipv6
2318
fi
2419

20+
echo -n "" > ${CFM_logs_file}
21+
${Clash_bin_path} -v >> ${CFM_logs_file}
22+
echo "${date_day}" >> ${CFM_logs_file}
23+
echo "Clash for Magisk v1.9.5" >> ${CFM_logs_file}
24+
2525
if [ "${use_premium}" == "true" ]; then
2626
echo "info msg= Mengunakan Clash Premium" >> ${CFM_logs_file}
2727
else

scripts/clash.tproxy

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,19 @@ tun_notif_on() {
3333
echo "info msg= connected" >> ${CFM_logs_file}
3434
}
3535
tproxy_notif_off() {
36-
echo "info msg= Iptables Tproxy dihapus" >> ${CFM_logs_file}
36+
if [ "${auto_iptables}" == "false" ]; then
37+
echo "info msg= Iptables Tproxy dihapus" >> ${CFM_logs_file}
38+
else
39+
echo "info msg= auto Iptables Tproxy dihapus" >> ${CFM_logs_file}
40+
fi
3741
echo "info msg= discontinued" >> ${CFM_logs_file}
3842
}
3943
tproxy_notif_on() {
40-
echo "info msg= Iptables Tproxy diterapkan" >> ${CFM_logs_file}
44+
if [ "${auto_iptables}" == "false" ]; then
45+
echo "info msg= Iptables Tproxy diterapkan" >> ${CFM_logs_file}
46+
else
47+
echo "info msg= auto Iptables Tproxy diterapkan" >> ${CFM_logs_file}
48+
fi
4149
echo "info msg= connected" >> ${CFM_logs_file}
4250
}
4351

@@ -377,8 +385,12 @@ while getopts ":sk" signal ; do
377385
case ${signal} in
378386
s)
379387
if [ "${Clash_tun_status}" == "false" ]; then
380-
start_tproxy && tproxy_notif_on
381-
rm_logs
388+
if [ "${auto_iptables}" == "false" ]; then
389+
start_tproxy && tproxy_notif_on
390+
rm_logs
391+
else
392+
tproxy_notif_on
393+
fi
382394
elif [ "${Clash_tun_status}" == "true" ]; then
383395
if [ "${Clash_auto_route}" == "true" ]; then
384396
${iptables_wait} -I FORWARD -o ${tun_device} -j ACCEPT
@@ -399,7 +411,11 @@ while getopts ":sk" signal ; do
399411
;;
400412
k)
401413
if [ "${Clash_tun_status}" == "false" ]; then
402-
stop_tproxy && tproxy_notif_off
414+
if [ "${auto_iptables}" == "false" ]; then
415+
stop_tproxy && tproxy_notif_off
416+
else
417+
tproxy_notif_off
418+
fi
403419
elif [ "${Clash_tun_status}" == "true" ]; then
404420
if [ "${Clash_auto_route}" == "true" ]; then
405421
${iptables_wait} -D FORWARD -o ${tun_device} -j ACCEPT

scripts/template

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
tproxy-port: 9898
22
bind-address: "*"
33
mode: rule
4+
ipv6: true
45
allow-lan: true
56
log-level: silent
6-
external-controller: 0.0.0.0:9090
7+
external-controller: 127.0.0.1:9090
78
external-ui: yacd-gh-pages
89
unified-delay: true
910
geodata-mode: false
1011
tcp-concurrent: false
1112
secret: ""
12-
ipv6: false
1313
udp: true
14+
tun:
15+
enable: false
16+
device: utun
17+
stack: system
18+
dns-hijack:
19+
- 'any:53'
20+
- 'tcp://any:53'
21+
auto-route: true
22+
auto-detect-interface: true
1423
dns:
1524
enable: true
16-
ipv6: false
25+
ipv6: true
1726
default-nameserver:
1827
- 1.1.1.1
1928
- 8.8.8.8
@@ -22,34 +31,40 @@ dns:
2231
fake-ip-range: 198.18.0.1/15
2332
use-hosts: true
2433
fake-ip-filter:
25-
- 'connect.rom.miui.com'
34+
- '*.lan'
2635
nameserver:
2736
- 'tls://1dot1dot1dot1.cloudflare-dns.com'
2837
- 'https://dns.cloudflare.com/dns-query'
29-
# fallback:
30-
# - 'tls://8.8.4.4:853'
38+
fallback:
39+
- 'https://1.0.0.1/dns-query#GLOBAL'
40+
- 'tls://8.8.4.4:853#GLOBAL'
3141
fallback-filter:
3242
geoip: false
33-
geoip-code: CN
43+
geoip-code: ID
44+
geosite:
45+
# - gfw
46+
domain:
47+
# - +.example.com
48+
ipcidr:
49+
# - 0.0.0.0/32
3450
sniffer:
3551
enable: false
3652
force: true
3753
Reverse:
38-
- +.google.com
54+
- '+.google.com'
3955
force-domain:
40-
- "google.com"
56+
- '+'
57+
- 'google.com'
4158
skip-sni:
42-
- www.baidu.com
59+
- '+.apple.com'
4360
sniffing:
4461
- tls
45-
tun:
46-
enable: false
47-
device: utun
48-
stack: system
49-
dns-hijack:
50-
- 'any:53'
51-
auto-route: false
52-
auto-detect-interface: false
62+
- http
63+
port-whitelist:
64+
- 443
65+
- 8000-9000
5366
iptables:
5467
enable: false
55-
inbound-interface: ""
68+
inbound-interface: "lo"
69+
bypass:
70+
interface-name: ""

0 commit comments

Comments
 (0)