Update CFwarp.sh

This commit is contained in:
甬哥侃侃侃ygkkk 2023-03-30 08:17:31 +00:00
parent 94b135a0e9
commit 02e4834397
1 changed files with 8 additions and 5 deletions

View File

@ -165,7 +165,7 @@ wgcfv4=$(curl -s4m6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cu
warpip(){ warpip(){
checkpt(){ checkpt2(){
a=`cat /root/warpip/result.csv | awk -F, '$3!="timeout ms" {print} ' | sed -n '2p' | awk -F ',' '{print $2}'` a=`cat /root/warpip/result.csv | awk -F, '$3!="timeout ms" {print} ' | sed -n '2p' | awk -F ',' '{print $2}'`
if [[ $a = 100.00% ]]; then if [[ $a = 100.00% ]]; then
v4v6 v4v6
@ -179,6 +179,7 @@ export endpoint=`cat /root/warpip/result.csv | awk -F, '$3!="timeout ms" {print}
fi fi
green "脚本将自动应用本地VPS优选的warp对端IP地址$endpoint" green "脚本将自动应用本地VPS优选的warp对端IP地址$endpoint"
} }
checkpt1(){
mkdir -p /root/warpip mkdir -p /root/warpip
if [[ ! -f '/root/warpip/result.csv' ]]; then if [[ ! -f '/root/warpip/result.csv' ]]; then
cpujg cpujg
@ -325,21 +326,23 @@ cd /root/warpip
./$cpu >/dev/null 2>&1 & ./$cpu >/dev/null 2>&1 &
wait wait
cd cd
checkpt checkpt2
else else
checkpt2
fi
}
checkwgcf checkwgcf
if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then
checkpt checkpt1
else else
systemctl stop wg-quick@wgcf >/dev/null 2>&1 systemctl stop wg-quick@wgcf >/dev/null 2>&1
kill -15 $(pgrep warp-go) >/dev/null 2>&1 && sleep 2 kill -15 $(pgrep warp-go) >/dev/null 2>&1 && sleep 2
checkpt checkpt1
systemctl start wg-quick@wgcf >/dev/null 2>&1 systemctl start wg-quick@wgcf >/dev/null 2>&1
systemctl restart warp-go >/dev/null 2>&1 systemctl restart warp-go >/dev/null 2>&1
systemctl enable warp-go >/dev/null 2>&1 systemctl enable warp-go >/dev/null 2>&1
systemctl start warp-go >/dev/null 2>&1 systemctl start warp-go >/dev/null 2>&1
fi fi
fi
} }
warpip warpip