~优化小米7000/万兆设备tproxy修复写法,增加开启时提示
~修复others.yaml无法正确合并的bug
~修复禁用配置文件覆写后,启动时报错的bug
This commit is contained in:
juewuy
2023-08-09 21:41:27 +08:00
parent e5e2e873c9
commit 5199d89a38
8 changed files with 23 additions and 11 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -3,4 +3,4 @@ clashpre_v=2022.11.25
clash_v=v1.7.1
meta_v=v1.15.0
GeoIP_v=20230805
versionsh=1.7.10g
versionsh=1.7.10h

View File

@@ -1092,7 +1092,6 @@ clashcfg(){
[ -n "$(iptables -j TPROXY 2>&1 | grep 'on-port')" ] && sup_tp=1
[ -n "$(lsmod | grep '^tun')" ] || ip tuntap &>/dev/null && sup_tun=1
ckcmd nft && sup_nft=1
#[ -n "$(lsmod | grep 'nft_tproxy')" ] && sup_nft=2
echo -----------------------------------------------
echo -e "当前代理模式为:\033[47;30m $redir_mod \033[0mClash核心为\033[47;30m $clashcore \033[0m"
echo -e "\033[33m切换模式后需要手动重启clash服务以生效\033[0m"
@@ -1125,7 +1124,12 @@ clashcfg(){
set_redir_config
elif [ "$num" = 3 ]; then
redir_mod=Tproxy混合
if [ -f /etc/init.d/qca-nss-ecm -a "$systype" = "mi_snapshot" ] ;then
read -p "当前设备的QOS服务与本模式冲突是否禁用相关功能(1/0) > " res
[ "$res" = '1' ] && $clashdir/misnap_init.sh tproxyfix && redir_mod=Tproxy混合
else
redir_mod=Tproxy混合
fi
set_redir_config
elif [ "$num" = 4 ]; then
@@ -1133,7 +1137,12 @@ clashcfg(){
set_redir_config
elif [ "$num" = 5 ]; then
redir_mod=Tproxy模式
if [ -f /etc/init.d/qca-nss-ecm -a "$systype" = "mi_snapshot" ] ;then
read -p "当前设备的QOS服务与本模式冲突是否禁用相关功能(1/0) > " res
[ "$res" = '1' ] && $clashdir/misnap_init.sh tproxyfix && redir_mod=Tproxy模式
else
redir_mod=Tproxy模式
fi
set_redir_config
elif [ "$num" = 6 ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Copyright (C) Juewuy
version=1.7.10g
version=1.7.10h
setdir(){
dir_avail(){

View File

@@ -36,6 +36,11 @@ tunfix(){
#将tun.ko链接到lib
ln -sf $clashdir/tools/tun.ko ${ko_dir}/tun.ko
}
tproxyfix(){
sed -i 's/sysctl -w net.bridge.bridge-nf-call-ip/#sysctl -w net.bridge.bridge-nf-call-ip/g' /etc/init.d/qca-nss-ecm
sysctl -w net.bridge.bridge-nf-call-iptables=0
sysctl -w net.bridge.bridge-nf-call-ip6tables=0
}
init(){
#等待启动完成
log_file=$(uci get system.@system[0].log_file)
@@ -59,10 +64,7 @@ init(){
#AX6S/AX6000修复tun功能
[ -f $clashdir/configs/tun.ko ] && tunfix
#小米7000/小米万兆修复tproxy
[ -f /etc/init.d/qca-nss-ecm ] && {
[ -f /proc/sys/net/bridge/bridge-nf-call-iptables ] && sysctl -w net.bridge.bridge-nf-call-iptables=0
[ -f /proc/sys/net/bridge/bridge-nf-call-ip6tables ] && sysctl -w net.bridge.bridge-nf-call-ip6tables=0
}
[ -f /etc/init.d/qca-nss-ecm ] && [ -n "$(grep 'redir_mod=Tproxy' $clashdir/configs/ShellClash.cfg )" ] && tproxyfix
#启动服务
/etc/init.d/clash start
/etc/init.d/clash enable
@@ -71,6 +73,7 @@ init(){
case "$1" in
tunfix) tunfix ;;
tproxyfix) tproxyfix ;;
init) init ;;
*)
if [ -z $(pidof clash) ];then

View File

@@ -452,7 +452,7 @@ EOF
}
[ -s $TMPDIR/dns.yaml ] && yaml_dns=$TMPDIR/dns.yaml
[ -s $TMPDIR/hosts.yaml ] && yaml_hosts=$TMPDIR/hosts.yaml
[ -s $TMPDIR/others.yaml ] && yaml_others=$clashdir/yamls/others.yaml
[ -s $clashdir/yamls/others.yaml ] && yaml_others=$clashdir/yamls/others.yaml
yaml_add=
for char in $yaml_char;do #将额外配置文件合并
[ -s $TMPDIR/${char}.yaml ] && {
@@ -1226,7 +1226,7 @@ bfstart(){
fi
fi
#生成配置文件
[ "$disoverride" != "1" ] && modify_yaml || ln -s $yaml $bindir/config.yaml
[ "$disoverride" != "1" ] && modify_yaml || ln -sf $yaml $bindir/config.yaml
}
afstart(){