From 58aba81a5c0598c707326d2a98630b508e17dfdf Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 26 Mar 2022 02:11:09 +0800 Subject: [PATCH] =?UTF-8?q?v1.5.6=20~=E5=A2=9E=E5=8A=A0fake-ip=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E8=BF=87=E6=BB=A4=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20~=E5=A2=9E=E5=8A=A0GeoSite=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E6=9B=B4=E6=96=B0=20~=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E8=8E=B7=E5=8F=96=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=8A=9F=E8=83=BD=EF=BC=8C=E7=8E=B0=E5=9C=A8=E4=BC=9A?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=9A=90=E8=97=8F=E6=97=A0=E6=95=88=E7=9A=84?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=BB=84=20~SSH=E5=9B=BA=E5=8C=96=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=94=AF=E6=8C=81=E5=AF=86=E7=A0=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20~=E4=BC=98=E5=8C=96Padavan=E8=AE=BE=E5=A4=87=E5=BC=80?= =?UTF-8?q?=E6=9C=BA=E8=87=AA=E5=90=AF=E4=B8=8D=E6=AD=A3=E5=B8=B8=E7=9A=84?= =?UTF-8?q?bug=20~=E4=BF=AE=E5=A4=8D=E4=B8=8D=E8=83=BD=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=9C=AC=E6=9C=BAhosts=E7=9A=84bug=20~?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtun=E5=8F=8A=E6=B7=B7=E5=90=88=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8D=E8=83=BD=E8=87=AA=E5=8A=A8=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E7=9A=84bug=20~=E5=85=B6=E4=BB=96=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8F=8A=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/clash.sh | 5 +++++ scripts/start.sh | 23 +++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/scripts/clash.sh b/scripts/clash.sh index 93db5e2..c456967 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -574,6 +574,11 @@ clashcfg(){ set_redir_config(){ setconfig redir_mod $redir_mod setconfig dns_mod $dns_mod + if [ "$redir_mod" = "混合模式" -o "$redir_mod" = "Tun模式" ] && [ "$clashcore" = "clash" ];then + rm -rf $bindir/clash + rm -rf $clashdir/clash + setconfig clashcore clash.meta + fi echo ----------------------------------------------- echo -e "\033[36m已设为 $redir_mod !!\033[0m" } diff --git a/scripts/start.sh b/scripts/start.sh index fa7a41b..c97e62c 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -254,6 +254,17 @@ EOF` setconfig clashcore clash.net echo ----------------------------------------------- fi + #检测并去除无效节点组 + cat $clashdir/config.yaml | grep -A 8 "\-\ name:" | xargs | sed 's/- name: /\n/g' | sed 's/ type: .*proxies: /#/g' | sed 's/ rules:.*//g' | sed 's/- //g' > /tmp/clash_proxies_$USER + while read line ;do + proxies=$(echo $line | awk -F '#' '{print $2}') + proxies_name=$(echo $line | awk -F '#' '{print $1}') + if [ "$proxies" = 'DIRECT' ];then + sed -i "/- $proxies_name/d" $yamlnew + sed -i "/- name: $proxies_name/,/- DIRECT/d" $yamlnew + fi + done < /tmp/clash_proxies_$USER + rm -rf /tmp/clash_proxies_$USER #使用核心内置test功能检测 if [ -x $bindir/clash ];then $bindir/clash -t -d $bindir -f $yamlnew >/dev/null @@ -272,7 +283,6 @@ EOF` mv -f $yamlnew $yaml fi echo -e "\033[32m已成功获取配置文件!\033[0m" - rm -rf $yamlnew exit 0 fi } @@ -656,16 +666,15 @@ web_restore(){ fi } #设置循环检测clash面板端口 - while [ "$i" != 1 ];do - [ "$j" = 60 ] && exit 1 + i=1 + while [ -z "$test" -a "$i" -lt 60 ];do sleep 1 if curl --version > /dev/null 2>&1;then test=$(curl -s http://localhost:${db_port}) else test=$(wget -q -O - http://localhost:${db_port}) fi - [ -n "$test" ] && i=1 - j=$((j+1)) + i=$((i+1)) done #发送数据 num=$(cat $clashdir/web_save | wc -l) @@ -710,7 +719,7 @@ bfstart(){ else logger "未找到clash核心,正在下载!" 33 if [ -z "$clashcore" ];then - [ "$redir_mod" = "混合模式" -o "$redir_mod" = "Tun模式" ] && clashcore=clash.net || clashcore=clash + [ "$redir_mod" = "混合模式" -o "$redir_mod" = "Tun模式" ] && clashcore=clash.meta || clashcore=clash fi [ -z "$cpucore" ] && source $clashdir/getdate.sh && getcpucore [ -z "$cpucore" ] && logger 找不到设备的CPU信息,请手动指定处理器架构类型! 31 && setcpucore @@ -718,6 +727,7 @@ bfstart(){ [ "$?" = "1" ] && rm -rf $bindir/clash && logger "核心下载失败,已退出!" 31 && exit 1 [ ! -x $bindir/clash ] && chmod +x $bindir/clash #检测可执行权限 clashv=$($bindir/clash -v | awk '{print $2}') + setconfig clashcore $clashcore setconfig clashv $clashv fi fi @@ -891,6 +901,7 @@ restart) init) if [ -d "/etc/storage/clash" ];then clashdir=/etc/storage/clash + i=1 while [ ! -w "/etc/profile" -a "$i" -lt 60 ];do sleep 1 && i=$((i+1)) done