~新增CDN下载源和Github下载源,下载更新速度更快
~新增了切换下载源的选项菜单
~界面UI优化及bug修复
This commit is contained in:
juewuy
2020-08-10 20:24:28 +08:00
parent 022cd07935
commit 31865ff734
5 changed files with 200 additions and 147 deletions

Binary file not shown.

View File

@@ -1 +1 @@
versionsh=0.8.5 versionsh=0.8.6

View File

@@ -11,17 +11,17 @@ url="https://juewuy.xyz/clash"
result=$(curl -w %{http_code} -skLo /tmp/clashversion $url/bin/version) result=$(curl -w %{http_code} -skLo /tmp/clashversion $url/bin/version)
[ "$result" != "200" ] && echo "无法连接到服务器!" && exit 1 [ "$result" != "200" ] && echo "无法连接到服务器!" && exit 1
source /tmp/clashversion source /tmp/clashversion
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "~~~~版本:\033[32m$versionsh\033[0m" echo -e "~~~~版本:\033[32m$versionsh\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[44m使用中如遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m" echo -e "\033[44m使用中如遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m"
echo -e "\033[37m目前仅支持小米AX系列3款路由器" echo -e "\033[37m目前仅支持小米AX系列3款路由器"
echo -e "\033[44m其余型号可到TG群报名参与测试\033[0m" echo -e "\033[44m其余型号可到TG群报名参与测试\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32m 1 在默认目录(/etc)安装Clash for Miwifi" echo -e "\033[32m 1 在默认目录(/etc)安装Clash for Miwifi"
echo -e "\033[33m 2 手动设置安装目录(不明勿用!)" echo -e "\033[33m 2 手动设置安装目录(不明勿用!)"
echo -e "\033[0m 0 退出安装" echo -e "\033[0m 0 退出安装"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read -p "请输入相应数字 > " num read -p "请输入相应数字 > " num
if [ -z $num ];then if [ -z $num ];then
@@ -30,7 +30,7 @@ if [ -z $num ];then
elif [[ $num == 1 ]];then elif [[ $num == 1 ]];then
dir=/etc dir=/etc
elif [[ $num == 2 ]];then elif [[ $num == 2 ]];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo '可用路径 剩余空间:' echo '可用路径 剩余空间:'
df -h | awk '{print $6,$2}'| sed 1d df -h | awk '{print $6,$2}'| sed 1d
echo '路径是必须带 / 的格式,写入虚拟内存(/tmp,/sys,..)的文件会在重启后消失!!!' echo '路径是必须带 / 的格式,写入虚拟内存(/tmp,/sys,..)的文件会在重启后消失!!!'
@@ -44,9 +44,9 @@ else
exit; exit;
fi fi
#下载文件包 #下载文件包
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 开始从服务器获取安装文件! echo 开始从服务器获取安装文件!
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tarurl=$url/bin/clashfm.tar.gz tarurl=$url/bin/clashfm.tar.gz
if command -v curl &> /dev/null; then if command -v curl &> /dev/null; then
result=$(curl -w %{http_code} -kLo /tmp/clashfm.tar.gz $tarurl) result=$(curl -w %{http_code} -kLo /tmp/clashfm.tar.gz $tarurl)
@@ -56,7 +56,7 @@ else $result
fi fi
[ "$result" != "200" ] && echo "文件下载失败!" && exit 1 [ "$result" != "200" ] && echo "文件下载失败!" && exit 1
#解压 #解压
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 开始解压文件! echo 开始解压文件!
mkdir -p $dir/clash > /dev/null mkdir -p $dir/clash > /dev/null
tar -zxvf '/tmp/clashfm.tar.gz' -C $dir/clash/ > /dev/null tar -zxvf '/tmp/clashfm.tar.gz' -C $dir/clash/ > /dev/null
@@ -80,8 +80,8 @@ echo "export clashdir=\"$dir/clash\"" >> /etc/profile #设置clash路径环境
#删除临时文件 #删除临时文件
rm -rf /tmp/clashfm.tar.gz rm -rf /tmp/clashfm.tar.gz
#提示 #提示
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo clash for Miwifi 已经安装成功! echo clash for Miwifi 已经安装成功!
echo -e "\033[33m直接输入\033[30;47m clash \033[0;33m命令即可管理\033[0m" echo -e "\033[33m直接输入\033[30;47m clash \033[0;33m命令即可管理\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -1,17 +1,13 @@
#!/bin/sh #!/bin/sh
# Copyright (C) Juewuy # Copyright (C) Juewuy
echo "***********************************************"
echo "** 欢迎使用 **"
echo "** Clash for Miwifi **"
echo "** by Juewuy **"
echo "***********************************************"
getconfig(){ getconfig(){
#版本号 #版本号
versionsh_l=0.8.5 versionsh_l=0.8.6
#更新服务器地址 #服务器地址
update_url="https://juewuy.xyz/clash" if [ ! -n "$update_url" ]; then
update_url=https://cdn.jsdelivr.net/gh/juewuy/clash-for-Miwifi/
fi
#文件路径 #文件路径
if [ -z $clashdir ];then if [ -z $clashdir ];then
clashdir=$(dirname $(readlink -f "$0")) clashdir=$(dirname $(readlink -f "$0"))
@@ -61,21 +57,25 @@ else
run="\033[31m没有运行$redir_mod\033[0m" run="\033[31m没有运行$redir_mod\033[0m"
fi fi
#输出状态 #输出状态
echo -----------------------------------------------
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[30;46m欢迎使用Clash for Miwifi\033[0m"
echo -e "Clash服务"$run""$auto"" echo -e "Clash服务"$run""$auto""
if [ $status -gt 0 ];then if [ $status -gt 0 ];then
echo -e "当前内存占用:\033[44m"$VmRSS"\033[0m已运行\033[46;30m"$day"\033[44;37m"$time"\033[0m" echo -e "当前内存占用:\033[44m"$VmRSS"\033[0m已运行\033[46;30m"$day"\033[44;37m"$time"\033[0m"
fi fi
echo -e "我的博客:\033[36;4mjuewuy.xyz\033[0m交流反馈群\033[36;4mt.me/clashfm\033[0m"
echo -----------------------------------------------
#安装clash核心 #安装clash核心
if [ ! -f $clashdir/clash ];then if [ ! -f $clashdir/clash ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m没有找到核心文件请先下载clash核心\033[0m" echo -e "\033[31m没有找到核心文件请先下载clash核心\033[0m"
source $clashdir/getdate.sh source $clashdir/getdate.sh
getcore getcore
fi fi
#安装GeoIP数据库 #安装GeoIP数据库
if [ ! -f $clashdir/Country.mmdb ];then if [ ! -f $clashdir/Country.mmdb ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m没有找到GeoIP数据库文件请先下载数据库\033[0m" echo -e "\033[31m没有找到GeoIP数据库文件请先下载数据库\033[0m"
source $clashdir/getdate.sh source $clashdir/getdate.sh
getgeo getgeo
@@ -88,13 +88,13 @@ sleep 1
status=`ps |grep -w 'clash -d'|grep -v grep|wc -l` status=`ps |grep -w 'clash -d'|grep -v grep|wc -l`
if [[ $status -gt 0 ]];then if [[ $status -gt 0 ]];then
host=$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';) host=$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32mclash服务已启动\033[0m" echo -e "\033[32mclash服务已启动\033[0m"
echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理内置规则" echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理内置规则"
echo -e "也可以前往更新菜单安装本地Dashboard面板连接更稳定" echo -e "也可以前往更新菜单安装本地Dashboard面板连接更稳定"
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m" echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m"
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31mclash服务启动失败请检查配置文件\033[0m" echo -e "\033[31mclash服务启动失败请检查配置文件\033[0m"
fi fi
} }
@@ -111,9 +111,9 @@ if [ ! -n "$server_link" ]; then
sed -i "5i\server_link=1" $ccfg sed -i "5i\server_link=1" $ccfg
server_link=1 server_link=1
fi fi
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[30;47m 欢迎使用订阅功能!\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[44m 实验性功能遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m"
echo -e "\033[32m 欢迎使用订阅功能!\033[0m"
echo -e " 1 输入\033[36m节点/订阅\033[0m链接" echo -e " 1 输入\033[36m节点/订阅\033[0m链接"
echo -e " 2 输入完整clash规则链接" echo -e " 2 输入完整clash规则链接"
echo -e " 3 选取\033[33m代理规则\033[0m模版" echo -e " 3 选取\033[33m代理规则\033[0m模版"
@@ -124,19 +124,19 @@ echo -e " 7 设置自动更新(未完成)"
echo -e " 0 返回上级菜单" echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [ -z $num ];then if [ -z $num ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashsh clashsh
elif [[ $num == 1 ]];then elif [[ $num == 1 ]];then
if [ -n "$Url" ];then if [ -n "$Url" ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[33m检测到已记录的订阅链接\033[0m" echo -e "\033[33m检测到已记录的订阅链接\033[0m"
echo -e "\033[4;32m$Url\033[0m" echo -e "\033[4;32m$Url\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read -p "清空链接/追加导入?[1/0] > " res read -p "清空链接/追加导入?[1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
Url="" Url=""
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m链接已清空\033[0m" echo -e "\033[31m链接已清空\033[0m"
fi fi
fi fi
@@ -145,21 +145,21 @@ elif [[ $num == 1 ]];then
elif [[ $num == 2 ]];then elif [[ $num == 2 ]];then
if [ -n "$Url" ];then if [ -n "$Url" ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[33m检测到已记录的订阅链接\033[0m" echo -e "\033[33m检测到已记录的订阅链接\033[0m"
echo -e "\033[4;32m$Url\033[0m" echo -e "\033[4;32m$Url\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read -p "清空链接/追加导入?[1/0] > " res read -p "清空链接/追加导入?[1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
Url="" Url=""
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m链接已清空\033[0m" echo -e "\033[31m链接已清空\033[0m"
fi fi
fi fi
source $clashdir/getdate.sh source $clashdir/getdate.sh
getlink2 getlink2
elif [[ $num == 3 ]];then elif [[ $num == 3 ]];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[44m 实验性功能遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m" echo -e "\033[44m 实验性功能遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m"
echo 当前使用规则为:$rule_link echo 当前使用规则为:$rule_link
echo 1 ACL4SSR默认通用版推荐 echo 1 ACL4SSR默认通用版推荐
@@ -170,7 +170,7 @@ elif [[ $num == 3 ]];then
echo 0 返回上级菜单 echo 0 返回上级菜单
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [ -z $num ];then if [ -z $num ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashlink clashlink
else else
@@ -178,12 +178,12 @@ elif [[ $num == 3 ]];then
sed -i '/rule_link*/'d $ccfg sed -i '/rule_link*/'d $ccfg
sed -i "4i\rule_link="$num"" $ccfg sed -i "4i\rule_link="$num"" $ccfg
rule_link=$num rule_link=$num
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32m设置成功返回上级菜单\033[0m" echo -e "\033[32m设置成功返回上级菜单\033[0m"
clashlink clashlink
fi fi
elif [[ $num == 4 ]];then elif [[ $num == 4 ]];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[44m 实验性功能遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m" echo -e "\033[44m 实验性功能遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m"
echo 当前使用后端为:$server_link echo 当前使用后端为:$server_link
echo 1 subconverter-web.now.sh echo 1 subconverter-web.now.sh
@@ -196,7 +196,7 @@ elif [[ $num == 4 ]];then
echo 0 返回上级菜单 echo 0 返回上级菜单
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [ -z $num ];then if [ -z $num ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashlink clashlink
else else
@@ -207,40 +207,40 @@ elif [[ $num == 4 ]];then
sed -i '/server_link*/'d $ccfg sed -i '/server_link*/'d $ccfg
sed -i "4i\server_link="$num"" $ccfg sed -i "4i\server_link="$num"" $ccfg
server_link=$num server_link=$num
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32m设置成功返回上级菜单\033[0m" echo -e "\033[32m设置成功返回上级菜单\033[0m"
clashlink clashlink
fi fi
elif [[ $num == 5 ]];then elif [[ $num == 5 ]];then
yamlbak=$yaml.bak yamlbak=$yaml.bak
if [ ! -f "$yaml".bak ];then if [ ! -f "$yaml".bak ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m没有找到配置文件的备份\033[0m" echo -e "\033[31m没有找到配置文件的备份\033[0m"
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e 备份文件共有"\033[32m`wc -l < $yamlbak`\033[0m"行内容,当前文件共有"\033[32m`wc -l < $yaml`\033[0m"行内容 echo -e 备份文件共有"\033[32m`wc -l < $yamlbak`\033[0m"行内容,当前文件共有"\033[32m`wc -l < $yaml`\033[0m"行内容
read -p "确认还原配置文件?此操作不可逆![1/0] > " res read -p "确认还原配置文件?此操作不可逆![1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
mv $yamlbak $yaml mv $yamlbak $yaml
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32m配置文件已还原请手动重启clash服务\033[0m" echo -e "\033[32m配置文件已还原请手动重启clash服务\033[0m"
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m操作已取消返回上级菜单\033[0m" echo -e "\033[31m操作已取消返回上级菜单\033[0m"
fi fi
fi fi
clashsh clashsh
elif [[ $num == 6 ]];then elif [[ $num == 6 ]];then
if [ ! -n "$Url" ];then if [ ! -n "$Url" ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 没有找到你的订阅链接!请先输入链接! echo 没有找到你的订阅链接!请先输入链接!
clashlink clashlink
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[33m当前系统记录的订阅链接为\033[0m" echo -e "\033[33m当前系统记录的订阅链接为\033[0m"
echo -e "\033[4;32m$Url\033[0m" echo -e "\033[4;32m$Url\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read -p "确认更新配置文件?[1/0] > " res read -p "确认更新配置文件?[1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
source $clashdir/getdate.sh source $clashdir/getdate.sh
@@ -251,7 +251,7 @@ elif [[ $num == 6 ]];then
elif [[ $num == 0 ]];then elif [[ $num == 0 ]];then
clashsh clashsh
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
exit; exit;
fi fi
@@ -274,9 +274,10 @@ if [ ! -n "$ipv6_support" ]; then
ipv6_support=未开启 ipv6_support=未开启
fi fi
# #
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[30;47m欢迎使用高级模式菜单\033[0m"
echo -e "\033[33m修改配置后请手动重启clash服务\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[33m欢迎使用高级模式菜单\033[0m"
echo -e "\033[32m修改配置后请手动重启clash服务\033[0m"
echo -e " 1 切换Clash运行模式: \033[36m$redir_mod\033[0m" echo -e " 1 切换Clash运行模式: \033[36m$redir_mod\033[0m"
echo -e " 2 切换DNS运行模式 \033[36m$dns_mod\033[0m" echo -e " 2 切换DNS运行模式 \033[36m$dns_mod\033[0m"
echo -e " 3 跳过本地证书验证: \033[36m$skip_cert\033[0m ————解决节点证书验证错误" echo -e " 3 跳过本地证书验证: \033[36m$skip_cert\033[0m ————解决节点证书验证错误"
@@ -290,10 +291,11 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
if [[ $num == 0 ]]; then if [[ $num == 0 ]]; then
clashsh clashsh
elif [[ $num == 1 ]]; then elif [[ $num == 1 ]]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "当前代理模式为:\033[47;30m $redir_mod \033[0mClash核心为\033[47;30m $clashcore \033[0m" echo -e "当前代理模式为:\033[47;30m $redir_mod \033[0mClash核心为\033[47;30m $clashcore \033[0m"
echo -e "\033[33m切换模式后需要手动重启clash服务以生效\033[0m" echo -e "\033[33m切换模式后需要手动重启clash服务以生效\033[0m"
echo -e "\033[36mTun及混合模式必须使用clashpre核心\033[0m" echo -e "\033[36mTun及混合模式必须使用clashpre核心\033[0m"
echo -----------------------------------------------
echo " 1 Redir模式CPU以及内存占用较低" echo " 1 Redir模式CPU以及内存占用较低"
echo " 但不支持UDP流量转发" echo " 但不支持UDP流量转发"
echo " 日常使用推荐此模式" echo " 日常使用推荐此模式"
@@ -306,7 +308,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
echo " 0 返回上级菜单" echo " 0 返回上级菜单"
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [ -z $num ]; then if [ -z $num ]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashadv clashadv
elif [[ $num == 0 ]]; then elif [[ $num == 0 ]]; then
@@ -315,7 +317,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
redir_mod=Redir模式 redir_mod=Redir模式
elif [[ $num == 2 ]]; then elif [[ $num == 2 ]]; then
if [ "$clashcore" = "clash" ] || [ "$clashcore" = "clashr" ];then if [ "$clashcore" = "clash" ] || [ "$clashcore" = "clashr" ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m当前核心不支持开启Tun模式请先切换clash核心\033[0m" echo -e "\033[31m当前核心不支持开启Tun模式请先切换clash核心\033[0m"
clashadv clashadv
fi fi
@@ -323,13 +325,13 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
dns_mod=fake-ip dns_mod=fake-ip
elif [[ $num == 3 ]]; then elif [[ $num == 3 ]]; then
if [ "$clashcore" = "clash" ] || [ "$clashcore" = "clashr" ];then if [ "$clashcore" = "clash" ] || [ "$clashcore" = "clashr" ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m当前核心不支持开启Tun模式请先切换clash核心\033[0m" echo -e "\033[31m当前核心不支持开启Tun模式请先切换clash核心\033[0m"
clashadv clashadv
fi fi
redir_mod=混合模式 redir_mod=混合模式
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashadv clashadv
fi fi
@@ -337,14 +339,15 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
sed -i "1i\redir_mod=$redir_mod" $ccfg sed -i "1i\redir_mod=$redir_mod" $ccfg
sed -i '/dns_mod*/'d $ccfg sed -i '/dns_mod*/'d $ccfg
sed -i "1i\dns_mod=$dns_mod" $ccfg sed -i "1i\dns_mod=$dns_mod" $ccfg
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[36m已设为 $redir_mod \033[0m" echo -e "\033[36m已设为 $redir_mod \033[0m"
clashadv clashadv
elif [[ $num == 2 ]]; then elif [[ $num == 2 ]]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "当前DNS运行模式为\033[47;30m $dns_mod \033[0m" echo -e "当前DNS运行模式为\033[47;30m $dns_mod \033[0m"
echo -e "\033[33m切换模式后需要手动重启clash服务以生效\033[0m" echo -e "\033[33m切换模式后需要手动重启clash服务以生效\033[0m"
echo -----------------------------------------------
echo " 1 fake-ip模式 响应速度更快" echo " 1 fake-ip模式 响应速度更快"
echo " 但可能和部分软件有冲突" echo " 但可能和部分软件有冲突"
echo " 2 redir_host模式使用稳定兼容性好" echo " 2 redir_host模式使用稳定兼容性好"
@@ -352,7 +355,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
echo " 0 返回上级菜单" echo " 0 返回上级菜单"
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [ -z $num ]; then if [ -z $num ]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashadv clashadv
elif [[ $num == 0 ]]; then elif [[ $num == 0 ]]; then
@@ -363,7 +366,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
dns_mod=redir_host dns_mod=redir_host
redir_mod=Redir模式 redir_mod=Redir模式
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashadv clashadv
fi fi
@@ -371,13 +374,13 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
sed -i "1i\dns_mod=$dns_mod" $ccfg sed -i "1i\dns_mod=$dns_mod" $ccfg
sed -i '/redir_mod*/'d $ccfg sed -i '/redir_mod*/'d $ccfg
sed -i "1i\redir_mod=$redir_mod" $ccfg sed -i "1i\redir_mod=$redir_mod" $ccfg
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[36m已设为 $dns_mod 模式!!\033[0m" echo -e "\033[36m已设为 $dns_mod 模式!!\033[0m"
clashadv clashadv
elif [[ $num == 3 ]]; then elif [[ $num == 3 ]]; then
sed -i '/skip_cert*/'d $ccfg sed -i '/skip_cert*/'d $ccfg
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ "$skip_cert" = "未开启" ] > /dev/null 2>&1; then if [ "$skip_cert" = "未开启" ] > /dev/null 2>&1; then
sed -i "1i\skip_cert=已开启" $ccfg sed -i "1i\skip_cert=已开启" $ccfg
echo -e "\033[33m已设为开启跳过本地证书验证\033[0m" echo -e "\033[33m已设为开启跳过本地证书验证\033[0m"
@@ -392,7 +395,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
elif [[ $num == 4 ]]; then elif [[ $num == 4 ]]; then
sed -i '/common_ports*/'d $ccfg sed -i '/common_ports*/'d $ccfg
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ "$common_ports" = "未开启" ] > /dev/null 2>&1; then if [ "$common_ports" = "未开启" ] > /dev/null 2>&1; then
sed -i "1i\common_ports=已开启" $ccfg sed -i "1i\common_ports=已开启" $ccfg
echo -e "\033[33m已设为仅代理22,53,587,465,995,993,143,80,443等常用端口\033[0m" echo -e "\033[33m已设为仅代理22,53,587,465,995,993,143,80,443等常用端口\033[0m"
@@ -407,7 +410,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
elif [[ $num == 5 ]]; then elif [[ $num == 5 ]]; then
sed -i '/modify_yaml*/'d $ccfg sed -i '/modify_yaml*/'d $ccfg
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ "$modify_yaml" = "未开启" ] > /dev/null 2>&1; then if [ "$modify_yaml" = "未开启" ] > /dev/null 2>&1; then
sed -i "1i\modify_yaml=已开启" $ccfg sed -i "1i\modify_yaml=已开启" $ccfg
echo -e "\033[33m已设为使用用户完成自定义配置文件" echo -e "\033[33m已设为使用用户完成自定义配置文件"
@@ -424,7 +427,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
elif [[ $num == 6 ]]; then elif [[ $num == 6 ]]; then
sed -i '/ipv6_support*/'d $ccfg sed -i '/ipv6_support*/'d $ccfg
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ "$ipv6_support" = "未开启" ] > /dev/null 2>&1; then if [ "$ipv6_support" = "未开启" ] > /dev/null 2>&1; then
sed -i "1i\ipv6_support=已开启" $ccfg sed -i "1i\ipv6_support=已开启" $ccfg
echo -e "\033[33m已开启对ipv6协议的支持\033[0m" echo -e "\033[33m已开启对ipv6协议的支持\033[0m"
@@ -440,7 +443,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
elif [[ $num == 9 ]]; then elif [[ $num == 9 ]]; then
if [ $status -gt 0 ];then if [ $status -gt 0 ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/etc/init.d/clash stop /etc/init.d/clash stop
echo -e "\033[31mClash服务已停止\033[0m" echo -e "\033[31mClash服务已停止\033[0m"
fi fi
@@ -451,16 +454,15 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
clashadv clashadv
fi fi
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashsh clashsh
fi fi
exit; exit;
} }
update(){ update(){
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[33m欢迎使用更新功能\033[0m" echo -e "\033[30;47m欢迎使用更新功能\033[0m"
echo -----------------------------------------------
echo -e "感谢:\033[32mClash \033[0m作者\033[36m Dreamacro\033[0m 项目地址:\033[32mhttps://github.com/Dreamacro/clash\033[0m" echo -e "感谢:\033[32mClash \033[0m作者\033[36m Dreamacro\033[0m 项目地址:\033[32mhttps://github.com/Dreamacro/clash\033[0m"
echo -e "感谢:\033[32mClashR \033[0m作者\033[36m BROBIRD\033[0m 项目地址:\033[32mhttps://github.com/BROBIRD/clash\033[0m" echo -e "感谢:\033[32mClashR \033[0m作者\033[36m BROBIRD\033[0m 项目地址:\033[32mhttps://github.com/BROBIRD/clash\033[0m"
echo -e "感谢:\033[32m更多的帮助过我的人\033[0m" echo -e "感谢:\033[32m更多的帮助过我的人\033[0m"
@@ -469,6 +471,7 @@ echo -e " 1 更新\033[36m管理脚本\033[0m"
echo -e " 2 切换\033[33mclash核心\033[0m" echo -e " 2 切换\033[33mclash核心\033[0m"
echo -e " 3 更新\033[32mGeoIP数据库\033[0m" echo -e " 3 更新\033[32mGeoIP数据库\033[0m"
echo -e " 4 安装本地\033[35mDashboard\033[0m面板" echo -e " 4 安装本地\033[35mDashboard\033[0m面板"
echo -e " 8 切换\033[36m安装源\033[0m地址"
echo -e " 9 \033[31m卸载\033[34mClash for Miwfi\033[0m" echo -e " 9 \033[31m卸载\033[34mClash for Miwfi\033[0m"
echo -e " 0 返回上级菜单" echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
@@ -492,6 +495,10 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
source $clashdir/getdate.sh source $clashdir/getdate.sh
getdb getdb
elif [[ $num == 8 ]]; then
source $clashdir/getdate.sh
setserver
elif [[ $num == 9 ]]; then elif [[ $num == 9 ]]; then
read -p "确认卸载clash警告该操作不可逆[1/0] " res read -p "确认卸载clash警告该操作不可逆[1/0] " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
@@ -505,13 +512,14 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
sed -i '/export clashdir=*/'d /etc/profile sed -i '/export clashdir=*/'d /etc/profile
echo 已卸载clash相关文件 echo 已卸载clash相关文件
fi fi
echo -e "\033[31m操作已取消\033[0m"
exit; exit;
else else
echo -e "\033[31m暂未支持的选项\033[0m" echo -e "\033[31m暂未支持的选项\033[0m"
update update
fi fi
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashsh clashsh
fi fi
@@ -537,12 +545,12 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
elif [[ $num == 1 ]]; then elif [[ $num == 1 ]]; then
if [ ! -f "$yaml" ];then if [ ! -f "$yaml" ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m没有找到配置文件请先导入节点/订阅链接!\033[0m" echo -e "\033[31m没有找到配置文件请先导入节点/订阅链接!\033[0m"
clashlink clashlink
fi fi
if [ $status -gt 0 ];then if [ $status -gt 0 ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/etc/init.d/clash stop > /dev/null 2>&1 /etc/init.d/clash stop > /dev/null 2>&1
echo -e "\033[31mClash服务已停止\033[0m" echo -e "\033[31mClash服务已停止\033[0m"
fi fi
@@ -554,13 +562,13 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
elif [[ $num == 3 ]]; then elif [[ $num == 3 ]]; then
/etc/init.d/clash stop > /dev/null 2>&1 /etc/init.d/clash stop > /dev/null 2>&1
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31mClash服务已停止\033[0m" echo -e "\033[31mClash服务已停止\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit; exit;
elif [[ $num == 4 ]]; then elif [[ $num == 4 ]]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ -f /etc/rc.d/*clash ]; then if [ -f /etc/rc.d/*clash ]; then
/etc/init.d/clash disable /etc/init.d/clash disable
echo -e "\033[33m已禁止Clash开机启动\033[0m" echo -e "\033[33m已禁止Clash开机启动\033[0m"
@@ -571,7 +579,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
clashsh clashsh
elif [[ $num == 5 ]]; then elif [[ $num == 5 ]]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m正在施工中敬请期待\033[0m" echo -e "\033[31m正在施工中敬请期待\033[0m"
echo -e "\033[32m正在施工中敬请期待\033[0m" echo -e "\033[32m正在施工中敬请期待\033[0m"
echo -e "\033[33m正在施工中敬请期待\033[0m" echo -e "\033[33m正在施工中敬请期待\033[0m"
@@ -584,8 +592,8 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
clashlink clashlink
elif [[ $num == 8 ]]; then elif [[ $num == 8 ]]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[36m这里是测试命令菜单\033[0m" echo -e "\033[30;47m这里是测试命令菜单\033[0m"
echo -e "\033[33m如遇问题尽量运行相应命令后截图发群\033[0m" echo -e "\033[33m如遇问题尽量运行相应命令后截图发群\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo " 1 查看clash运行时的报错信息" echo " 1 查看clash运行时的报错信息"
@@ -597,7 +605,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
echo " 0 返回上级目录!" echo " 0 返回上级目录!"
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [ -z $num ]; then if [ -z $num ]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashsh clashsh
elif [[ $num == 0 ]]; then elif [[ $num == 0 ]]; then
@@ -609,30 +617,30 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
echo -e "\033[31m如有报错请截图后到TG群询问\033[0m" echo -e "\033[31m如有报错请截图后到TG群询问\033[0m"
exit; exit;
elif [[ $num == 2 ]]; then elif [[ $num == 2 ]]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netstat -ntulp |grep 53 netstat -ntulp |grep 53
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit; exit;
elif [[ $num == 3 ]]; then elif [[ $num == 3 ]]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
openssl speed -multi 4 -evp aes-128-gcm openssl speed -multi 4 -evp aes-128-gcm
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit; exit;
elif [[ $num == 4 ]]; then elif [[ $num == 4 ]]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
iptables -t nat -L PREROUTING --line-numbers iptables -t nat -L PREROUTING --line-numbers
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit; exit;
elif [[ $num == 5 ]]; then elif [[ $num == 5 ]]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sed -n '1,40p' $yaml sed -n '1,40p' $yaml
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit; exit;
elif [[ $num == 6 ]]; then elif [[ $num == 6 ]]; then
echo 注意:测试结果不保证一定准确! echo 注意:测试结果不保证一定准确!
delay=`curl -kx 127.0.0.1:7890 -o /dev/null -s -w '%{time_starttransfer}' 'https://google.tw' & { sleep 3 ; kill $! & }` > /dev/null 2>&1 delay=`curl -kx 127.0.0.1:7890 -o /dev/null -s -w '%{time_starttransfer}' 'https://google.tw' & { sleep 3 ; kill $! & }` > /dev/null 2>&1
delay=`echo |awk "{print $delay*1000}"` > /dev/null 2>&1 delay=`echo |awk "{print $delay*1000}"` > /dev/null 2>&1
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ `echo ${#delay}` -gt 1 ];then if [ `echo ${#delay}` -gt 1 ];then
echo -e "\033[32m连接成功响应时间为"$delay" ms\033[0m" echo -e "\033[32m连接成功响应时间为"$delay" ms\033[0m"
else else
@@ -640,7 +648,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
fi fi
clashsh clashsh
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
clashsh clashsh
fi fi
@@ -649,12 +657,12 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
update update
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
fi fi
exit 1 exit 1
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
fi fi
exit 1 exit 1

View File

@@ -26,23 +26,23 @@ if [ -z $Https ];then
markhttp=1 markhttp=1
fi fi
# #
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 正在连接服务器获取配置文件…………链接地址为: echo 正在连接服务器获取配置文件…………链接地址为:
echo -e "\033[4;32m$Https\033[0m" echo -e "\033[4;32m$Https\033[0m"
echo 可以手动复制该链接到浏览器打开并查看数据是否正常! echo 可以手动复制该链接到浏览器打开并查看数据是否正常!
echo -e "\033[36m-----------------------------------------------" echo -e "\033[36m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e "| |" echo -e "| |"
echo -e "| 需要一点时间,请耐心等待! |" echo -e "| 需要一点时间,请耐心等待! |"
echo -e "| \033[0m如长时间没有数据请用ctrl+c退出\033[36m |" echo -e "| \033[0m如长时间没有数据请用ctrl+c退出\033[36m |"
echo -e "-----------------------------------------------\033[0m" echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\033[0m"
#获取在线yaml文件 #获取在线yaml文件
yamlnew=$yaml.new yamlnew=$yaml.new
rm -rf $yamlnew > /dev/null 2>&1 rm -rf $yamlnew > /dev/null 2>&1
result=$(curl -w %{http_code} -kLo $yamlnew $Https) result=$(curl -w %{http_code} -kLo $yamlnew $Https)
if [ "$result" != "200" ];then if [ "$result" != "200" ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m配置文件获取失败\033[0m" echo -e "\033[31m配置文件获取失败\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo echo
if [ -z $markhttp ];then if [ -z $markhttp ];then
exit; exit;
@@ -73,7 +73,7 @@ else
sleep 1 sleep 1
status=`ps |grep -w 'clash -d'|grep -v grep|wc -l` status=`ps |grep -w 'clash -d'|grep -v grep|wc -l`
if [[ $status -gt 0 ]];then if [[ $status -gt 0 ]];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32mclash服务已启动\033[0m" echo -e "\033[32mclash服务已启动\033[0m"
echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理clash内置规则" echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理clash内置规则"
host=$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';) host=$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
@@ -83,7 +83,7 @@ else
sed -i "7i\Https=\'$Https\'" $ccfg sed -i "7i\Https=\'$Https\'" $ccfg
clashsh clashsh
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ -f $yaml.bak ];then if [ -f $yaml.bak ];then
echo -e "\033[31mclash服务启动失败已还原配置文件并重启clash\033[0m" echo -e "\033[31mclash服务启动失败已还原配置文件并重启clash\033[0m"
mv $yaml.bak $yaml mv $yaml.bak $yaml
@@ -95,13 +95,13 @@ else
fi fi
fi fi
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[33m获取到了配置文件但格式似乎不对\033[0m" echo -e "\033[33m获取到了配置文件但格式似乎不对\033[0m"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sed -n '1,20p' $yamlnew sed -n '1,20p' $yamlnew
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[33m请检查如上配置文件信息:\033[0m" echo -e "\033[33m请检查如上配置文件信息:\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fi fi
exit; exit;
fi fi
@@ -110,17 +110,18 @@ exit
getlink(){ getlink(){
#设置输入循环 #设置输入循环
i=1 i=1
while [ $i -le 9 ] while [ $i -le 99 ]
do do
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[44m 遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[44m 实验性功能遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m" echo -e "支持批量导入\033[30;46m Http/Https/Clash \033[0m等格式的订阅链接"
echo -e "支持批量导入\033[30;42m Vmess/SSR/SS/Trojan/Sock5 \033[0m等格式的节点链接"
echo -e "\033[31m使用SSR节点请务必使用支持SSR的clash核心\033[0m"
echo -e "多个较短的链接可以用\033[30;47m | \033[0m分隔以一次性输入"
echo -e "多个较长的链接请尽量分多次输入,可支持多达\033[30;47m 99 \033[0;36m次输入"
echo -e "\033[32m直接输入回车以结束输入并开始导入链接\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[33m支持批量导入\033[30;46m Http/Https/Clash \033[0;33m等格式的订阅链接"
echo -e "支持批量导入\033[30;42m Vmess/SSR/SS/Trojan/Sock5 \033[0;33m等格式的节点链接"
echo -e "\033[36m多个较短的链接可以用\033[30;47m | \033[0;36m分隔以一次性输入"
echo -e "多个较长的链接请尽量分多次输入,可支持多达\033[30;47m 9 \033[0;36m次输入"
echo -e "\033[31;47m注意SSR/SS不支持\033[30;47mchacha20加密 \033[0m"
echo -e "\033[44;37m直接输入回车以结束输入并开始导入链接\033[0m"
echo -e "\033[33m 0 返回上级目录!\033[0m" echo -e "\033[33m 0 返回上级目录!\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
read -p "请输入第"$i"个链接 > " url read -p "请输入第"$i"个链接 > " url
@@ -138,7 +139,7 @@ do
i=$(($i+1)) i=$(($i+1))
elif [ -z $url ];then elif [ -z $url ];then
if [ -n $Url ];then if [ -n $Url ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e 请检查输入的链接是否正确: echo -e 请检查输入的链接是否正确:
echo -e "\033[4m$Url\033[0m" echo -e "\033[4m$Url\033[0m"
read -p "确认导入配置文件原配置文件将被更名为config.yaml.bak![1/0] > " res read -p "确认导入配置文件原配置文件将被更名为config.yaml.bak![1/0] > " res
@@ -155,12 +156,12 @@ do
elif [[ $url == 0 ]];then elif [[ $url == 0 ]];then
clashlink clashlink
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的订阅/分享链接!!!\033[0m" echo -e "\033[31m请输入正确的订阅/分享链接!!!\033[0m"
fi fi
done done
#### ####
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 输入太多啦,可能会导致订阅失败! echo 输入太多啦,可能会导致订阅失败!
echo "多个较短的链接请尽量用“|”分隔以一次性输入!" echo "多个较短的链接请尽量用“|”分隔以一次性输入!"
echo -e "请检查输入的链接是否正确:\033[4m$Url\033[0m" echo -e "请检查输入的链接是否正确:\033[4m$Url\033[0m"
@@ -173,19 +174,20 @@ if [ "$res" = '1' ]; then
#获取在线yaml文件 #获取在线yaml文件
getyaml getyaml
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 操作已取消!返回上级菜单! echo 操作已取消!返回上级菜单!
clashlink clashlink
fi fi
clashlink clashlink
} }
getlink2(){ getlink2(){
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[44m 实验性功能,遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m" echo -e "\033[44m 遇问题请加TG群反馈\033[42;30m t.me/clashfm \033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[33m仅支持导入可直接在clash中使用的完整订阅链接" echo -e "\033[33m仅支持导入可直接在clash中使用的完整订阅链接"
echo -e "\033[36m非完整链接请使用【导入节点/订阅链接】功能" echo -e "\033[36m非完整链接请使用【导入节点/订阅链接】功能"
echo -e "\033[31m注意如节点使用了chacha20加密协议需将核心更新为clashr核心\033[0m" echo -e "\033[31m注意如节点使用了chacha20加密协议需将核心更新为clashr核心\033[0m"
echo -----------------------------------------------
echo -e "\033[33m0 返回上级目录!\033[0m" echo -e "\033[33m0 返回上级目录!\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
read -p "请输入完整链接 > " Https read -p "请输入完整链接 > " Https
@@ -194,7 +196,7 @@ Https=`echo ${Https/\ \(*\)/''}` #删除恶心的超链接内容
#Https=`echo ${Https//\&/\%26}` #将分隔符 & 替换成Httpscode%26 #Https=`echo ${Https//\&/\%26}` #将分隔符 & 替换成Httpscode%26
if [ -n $Https ];then if [ -n $Https ];then
if [ -n $test ];then if [ -n $test ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e 请检查输入的链接是否正确: echo -e 请检查输入的链接是否正确:
echo -e "\033[4m$Https\033[0m" echo -e "\033[4m$Https\033[0m"
read -p "确认导入配置文件原配置文件将被更名为config.yaml.bak![1/0] > " res read -p "确认导入配置文件原配置文件将被更名为config.yaml.bak![1/0] > " res
@@ -211,12 +213,12 @@ if [ -n $Https ];then
elif [[ $Https == 0 ]];then elif [[ $Https == 0 ]];then
clashlink clashlink
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的链接地址\033[0m" echo -e "\033[31m请输入正确的链接地址\033[0m"
fi fi
} }
getsh(){ getsh(){
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[33m正在检查更新\033[0m" echo -e "\033[33m正在检查更新\033[0m"
result=$(curl -w %{http_code} -skLo /tmp/clashversion $update_url/bin/version) result=$(curl -w %{http_code} -skLo /tmp/clashversion $update_url/bin/version)
[ "$result" != "200" ] && echo "检查更新失败!" && exit 1 [ "$result" != "200" ] && echo "检查更新失败!" && exit 1
@@ -268,10 +270,10 @@ fi
cpucore=armv7 cpucore=armv7
clashcore_n=$clashcore clashcore_n=$clashcore
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "当前clash核心\033[47;30m $clashcore \033[46;30m$clashv\033[0m" echo -e "当前clash核心\033[47;30m $clashcore \033[46;30m$clashv\033[0m"
echo -e "\033[32m请选择需要下载的核心版本\033[0m" echo -e "\033[32m请选择需要下载的核心版本\033[0m"
echo echo -----------------------------------------------
echo "1 clash 运行稳定,内存占用小" echo "1 clash 运行稳定,内存占用小"
echo "(官方正式版) 不支持SSR不支持Tun模式" echo "(官方正式版) 不支持SSR不支持Tun模式"
echo echo
@@ -280,11 +282,11 @@ echo "(clashR修改版)不支持Tun模式"
echo echo
echo "3 clashpre 支持SSR支持Tun模式" echo "3 clashpre 支持SSR支持Tun模式"
echo "(高级预览版) 内存占用高不支持chacha20加密" echo "(高级预览版) 内存占用高不支持chacha20加密"
echo echo -----------------------------------------------
echo 0 返回上级菜单 echo 0 返回上级菜单
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [ -z $num ]; then if [ -z $num ]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
update update
elif [[ $num == 0 ]]; then elif [[ $num == 0 ]]; then
@@ -296,7 +298,7 @@ read -p "请输入对应数字 > " num
elif [[ $num == 3 ]]; then elif [[ $num == 3 ]]; then
clashcore=clashpre clashcore=clashpre
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m" echo -e "\033[31m请输入正确的数字\033[0m"
update update
fi fi
@@ -304,26 +306,26 @@ read -p "请输入对应数字 > " num
corelink="$update_url/bin/$clashcore/clash-linux-$cpucore" corelink="$update_url/bin/$clashcore/clash-linux-$cpucore"
versionlink="$update_url/bin/$clashcore/version" versionlink="$update_url/bin/$clashcore/version"
#检测版本 #检测版本
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[33m正在检查更新\033[0m" echo -e "\033[33m正在检查更新\033[0m"
result=$(curl -w %{http_code} -skLo /tmp/clashversion $versionlink) result=$(curl -w %{http_code} -skLo /tmp/clashversion $versionlink)
[ "$result" != "200" ] && echo "检查更新失败!" && exit 1 [ "$result" != "200" ] && echo "检查更新失败!" && exit 1
source /tmp/clashversion source /tmp/clashversion
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "当前clash核心\033[0m $clashcore_n \033[33m$clashv\033[0m" echo -e "当前clash核心\033[0m $clashcore_n \033[33m$clashv\033[0m"
echo -e "最新clash核心\033[32m $clashcore \033[36m$version\033[0m" echo -e "最新clash核心\033[32m $clashcore \033[36m$version\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read -p "是否更新?[1/0] > " res read -p "是否更新?[1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 正在连接服务器获取clash核心文件…………链接地址为 echo 正在连接服务器获取clash核心文件…………链接地址为
echo -e "\033[4;32m$corelink\033[0m" echo -e "\033[4;32m$corelink\033[0m"
echo 如无法正常下载可以手动复制到浏览器下载核心文件! echo 如无法正常下载可以手动复制到浏览器下载核心文件!
echo -e "\033[36m-----------------------------------------------" echo -e "\033[36m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e "| |" echo -e "| |"
echo -e "| 需要一点时间,请耐心等待! |" echo -e "| 需要一点时间,请耐心等待! |"
echo -e "| \033[0m如长时间没有数据请用ctrl+c退出 |" echo -e "| \033[0m如长时间没有数据请用ctrl+c退出 |"
echo -e "-----------------------------------------------\033[0m" echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\033[0m"
#获取在线clash核心文件 #获取在线clash核心文件
result=$(curl -w %{http_code} -kLo /tmp/clash.new $corelink) result=$(curl -w %{http_code} -kLo /tmp/clash.new $corelink)
if [ "$result" != "200" ];then if [ "$result" != "200" ];then
@@ -340,7 +342,7 @@ if [ "$res" = '1' ]; then
sed -i '/clashv=*/'d $ccfg sed -i '/clashv=*/'d $ccfg
sed -i "1i\clashv=$version" $ccfg sed -i "1i\clashv=$version" $ccfg
rm -rf /tmp/clashversion rm -rf /tmp/clashversion
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32m$clashcore核心替换成功请手动启动clash服务\033[0m" echo -e "\033[32m$clashcore核心替换成功请手动启动clash服务\033[0m"
clashsh clashsh
fi fi
@@ -349,19 +351,23 @@ getcore
fi fi
} }
getgeo(){ getgeo(){
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32m感谢Alecthw大神提供的优质GeoIP数据库\033[0m" echo -e "\033[30;46m感谢Alecthw大神提供的优质GeoIP数据库\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[33m请选择下载源\033[0m" echo -e "\033[33m请选择下载源\033[0m"
echo -e " 1 我的个人服务器" echo -e " 1 默认源:$update_url"
echo -e " 2 Alecthw大神提供的服务器" echo -e " 2 Alecthw大神提供的服务器"
echo -e " 0 返回上级菜单" echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
if [[ $num == 0 ]]; then if [ -z $num ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
update
elif [[ $num == 0 ]]; then
update update
elif [[ $num == 1 ]]; then elif [[ $num == 1 ]]; then
geolink="$update_url/bin/Country.mmdb" geolink="$update_url/bin/Country.mmdb"
echo $geolink #echo $geolink
elif [[ $num == 2 ]]; then elif [[ $num == 2 ]]; then
geolink="http://www.ideame.top/mmdb/Country.mmdb" geolink="http://www.ideame.top/mmdb/Country.mmdb"
else else
@@ -369,16 +375,16 @@ read -p "请输入对应数字 > " num
update update
exit; exit;
fi fi
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 正在从服务器获取数据库文件………… echo 正在从服务器获取数据库文件…………
result=$(curl -w %{http_code} -kLo $clashdir/Country.mmdb $geolink) result=$(curl -w %{http_code} -kLo $clashdir/Country.mmdb $geolink)
if [ "$result" != "200" ];then if [ "$result" != "200" ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m文件下载失败\033[0m" echo -e "\033[31m文件下载失败\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
getgeo getgeo
else else
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32mGeoIP数据库文件下载成功\033[0m" echo -e "\033[32mGeoIP数据库文件下载成功\033[0m"
update update
fi fi
@@ -386,7 +392,7 @@ update
} }
getdb(){ getdb(){
host=$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';) host=$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[36m安装本地版dashboard管理面板\033[0m" echo -e "\033[36m安装本地版dashboard管理面板\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[32m打开管理面板的速度更快且更稳定" echo -e "\033[32m打开管理面板的速度更快且更稳定"
@@ -396,9 +402,9 @@ echo -----------------------------------------------
read -p "是否安装本地面板?[1/0] > " res read -p "是否安装本地面板?[1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
if [ -d /www/clash ];then if [ -d /www/clash ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m检测到您已经安装过本地面板了\033[0m" echo -e "\033[31m检测到您已经安装过本地面板了\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read -p "是否覆盖安装?[1/0] > " res read -p "是否覆盖安装?[1/0] > " res
if [ -z "$res" ]; then if [ -z "$res" ]; then
update update
@@ -409,13 +415,13 @@ if [ "$res" = '1' ]; then
fi fi
fi fi
dblink="$update_url/bin/clashdb.tar.gz" dblink="$update_url/bin/clashdb.tar.gz"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 正在连接服务器获取安装文件………… echo 正在连接服务器获取安装文件…………
result=$(curl -w %{http_code} -kLo /tmp/clashdb.tar.gz $dblink) result=$(curl -w %{http_code} -kLo /tmp/clashdb.tar.gz $dblink)
if [ "$result" != "200" ];then if [ "$result" != "200" ];then
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m文件下载失败\033[0m" echo -e "\033[31m文件下载失败\033[0m"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
getdb getdb
else else
echo -e "\033[33m下载成功正在解压文件\033[0m" echo -e "\033[33m下载成功正在解压文件\033[0m"
@@ -423,7 +429,7 @@ if [ "$res" = '1' ]; then
tar -zxvf '/tmp/clashdb.tar.gz' -C /www/clash > /dev/null tar -zxvf '/tmp/clashdb.tar.gz' -C /www/clash > /dev/null
[ $? -ne 0 ] && echo "文件解压失败!" && exit 1 [ $? -ne 0 ] && echo "文件解压失败!" && exit 1
echo -e "\033[32m面板安装成功" echo -e "\033[32m面板安装成功"
echo ----------------------------------------------- echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[36m请使用\033[32;4mhttp://$host/clash\033[0;36m访问面板\033[0m" echo -e "\033[36m请使用\033[32;4mhttp://$host/clash\033[0;36m访问面板\033[0m"
rm -rf /tmp/clashdb.tar.gz rm -rf /tmp/clashdb.tar.gz
update update
@@ -431,3 +437,42 @@ if [ "$res" = '1' ]; then
fi fi
update update
} }
setserver(){
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[30;47m您可以在此处切换在线更新时使用的资源地址\033[0m"
echo -e "当前源:\033[4;32m$update_url\033[0m"
echo -----------------------------------------------
echo -e " 1 CDN源(感谢\033[4;32mwww.jsdelivr.com\033[0m推荐)"
echo -e " 2 Github源(不稳定,不推荐)"
echo -e " 3 Github源+clash代理(需开启clash服务推荐)"
echo -e " 4 自定义输入"
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [ -z $num ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
update
elif [[ $num == 1 ]]; then
update_url="https://cdn.jsdelivr.net/gh/juewuy/clash-for-Miwifi"
elif [[ $num == 9 ]]; then
update_url="https://juewuy.xyz/clash"
elif [[ $num == 2 ]]; then
update_url="https://raw.githubusercontent.com/juewuy/clash-for-Miwifi/master"
elif [[ $num == 3 ]]; then
update_url="-x 127.0.0.1:7890 https://raw.githubusercontent.com/juewuy/clash-for-Miwifi/master"
elif [[ $num == 4 ]]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read -p "请输入个人源路径 > " update_url
else
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[31m请输入正确的数字\033[0m"
update
fi
#写入mark文件
sed -i '/update_url*/'d $ccfg
sed -i "1i\update_url=\'$update_url\'" $ccfg
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo -e "\033[32m源地址更新成功\033[0m"
update
}