v1.0.0beta9fix2

~修复ipv6开启后dns被污染的问题
~修复导入订阅后不显示本机host地址的问题
~修复卸载时未清理本机代理的bug
This commit is contained in:
juewuy 2020-09-25 10:10:33 +08:00
parent ddf17bf39a
commit 38aeddd90d
5 changed files with 36 additions and 52 deletions

Binary file not shown.

View File

@ -1,2 +1,2 @@
GeoIP_v=20200917 GeoIP_v=20200917
versionsh=1.0.0beta9fix1 versionsh=1.0.0beta9fix2

View File

@ -16,12 +16,7 @@ fi
ccfg=$clashdir/mark ccfg=$clashdir/mark
yaml=$clashdir/config.yaml yaml=$clashdir/config.yaml
#检查/读取标识文件 #检查/读取标识文件
if [ ! -f $ccfg ]; then [ ! -f $ccfg ]&& echo '#标识clash运行状态的文件不明勿动' >> $ccfg
echo mark文件不存在正在创建
cat >$ccfg<<EOF
#标识clash运行状态的文件不明勿动
EOF
fi
source $ccfg source $ccfg
#检查mac地址记录 #检查mac地址记录
[ ! -f $clashdir/mac ] && touch $clashdir/mac [ ! -f $clashdir/mac ] && touch $clashdir/mac
@ -99,6 +94,19 @@ if [ ! -f $clashdir/Country.mmdb ];then
clashstart clashstart
fi fi
} }
start_over(){
echo -e "\033[32mclash服务已启动\033[0m"
if [ -d /www/clash ];then
echo -e "请使用\033[30;47m http://$host/clash \033[0m管理内置规则"
elif [ -d $clashdir/ui ];then
echo -e "请使用\033[30;47m http://$host:9999/ui \033[0m管理内置规则"
else
echo -e "可使用\033[30;47m http://clash.razord.top \033[0m管理内置规则"
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m"
echo -e "也可前往更新菜单安装本地Dashboard面板连接更稳定\033[0m"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fi
}
clashstart(){ clashstart(){
if [ ! -f "$yaml" ];then if [ ! -f "$yaml" ];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -119,18 +127,7 @@ clashstart(){
echo -e "\033[31mclash启动失败\033[0m" echo -e "\033[31mclash启动失败\033[0m"
exit exit
fi fi
start_over
echo -e "\033[32mclash服务已启动\033[0m"
if [ -d /www/clash ];then
echo -e "请使用\033[30;47m http://$host/clash \033[0m管理内置规则"
elif [ -d $clashdir/ui ];then
echo -e "请使用\033[30;47m http://$host:9999/ui \033[0m管理内置规则"
else
echo -e "可使用\033[30;47m http://clash.razord.top \033[0m管理内置规则"
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m"
echo -e "也可前往更新菜单安装本地Dashboard面板连接更稳定\033[0m"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fi
} }
clashlink(){ clashlink(){
#获取订阅规则 #获取订阅规则
@ -242,7 +239,8 @@ elif [[ $num == 7 ]];then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read -p "确认更新配置文件?[1/0] > " res read -p "确认更新配置文件?[1/0] > " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
$clashdir/start.sh getyaml source $clashdir/start.sh
getyaml
fi fi
clashlink clashlink
fi fi
@ -657,7 +655,7 @@ echo -e " 5 生成本地PAC文件(需先安装本地面板)"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e " 7 切换\033[36m安装源\033[0m地址" echo -e " 7 切换\033[36m安装源\033[0m地址"
echo -e " 8 鸣谢" echo -e " 8 鸣谢"
echo -e " 9 \033[31m卸载\033[34mClash for Miwfi\033[0m" echo -e " 9 \033[31m卸载\033[34mShellClash\033[0m"
echo -e " 0 返回上级菜单" echo -e " 0 返回上级菜单"
echo ----------------------------------------------- echo -----------------------------------------------
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
@ -700,7 +698,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
update update
elif [[ $num == 9 ]]; then elif [[ $num == 9 ]]; then
read -p "确认卸载clash警告该操作不可逆[1/0] " res read -p "确认卸载ShellClash警告该操作不可逆[1/0] " res
if [ "$res" = '1' ]; then if [ "$res" = '1' ]; then
$clashdir/start.sh stop $clashdir/start.sh stop
rm -rf $clashdir rm -rf $clashdir
@ -710,9 +708,11 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
rm -rf /www/clash rm -rf /www/clash
sed -i '/alias clash=*/'d /etc/profile sed -i '/alias clash=*/'d /etc/profile
sed -i '/export clashdir=*/'d /etc/profile sed -i '/export clashdir=*/'d /etc/profile
sed -i '/http*_proxy/'d /etc/profile
sed -i '/HTTP*_PROXY/'d /etc/profile
source /etc/profile > /dev/null 2>&1 source /etc/profile > /dev/null 2>&1
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo 已卸载clash相关文件有缘再会 echo 已卸载ShellClash相关文件有缘再会
exit exit
fi fi
echo -e "\033[31m操作已取消\033[0m" echo -e "\033[31m操作已取消\033[0m"
@ -823,7 +823,7 @@ echo -e "\033[0m"-----------------------------------------------
echo -e " 1 设置\033[33m定时重启\033[0mclash服务" echo -e " 1 设置\033[33m定时重启\033[0mclash服务"
echo -e " 2 设置\033[31m定时停止\033[0mclash服务" echo -e " 2 设置\033[31m定时停止\033[0mclash服务"
echo -e " 3 设置\033[32m定时开启\033[0mclash服务" echo -e " 3 设置\033[32m定时开启\033[0mclash服务"
echo -e " 4 设置\033[33m定时更新\033[0m订阅链接(实验性,可能不稳定)" echo -e " 4 设置\033[33m定时更新\033[0m订阅并重启服务"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e " 0 返回上级菜单" echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num read -p "请输入对应数字 > " num
@ -951,7 +951,7 @@ if [[ $num -le 9 ]] > /dev/null 2>&1; then
elif [[ $num == 1 ]]; then elif [[ $num == 1 ]]; then
$clashdir/start.sh stop $clashdir/start.sh stop
echo ----------------------------------------------- echo -----------------------------------------------
$clashdir/clash -d $clashdir & { sleep 3 ; kill $! & } $clashdir/clash -t -d $clashdir
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[31m如有报错请截图后到TG群询问\033[0m" echo -e "\033[31m如有报错请截图后到TG群询问\033[0m"
exit; exit;

View File

@ -109,7 +109,8 @@ if [ -n $Url ];then
sed -i "6i\Url=\'$Url\'" $ccfg sed -i "6i\Url=\'$Url\'" $ccfg
Https="" Https=""
#获取在线yaml文件 #获取在线yaml文件
$clashdir/start.sh getyaml source $clashdir/start.sh
getyaml
elif [ "$num" = '2' ]; then elif [ "$num" = '2' ]; then
linkfilter linkfilter
linkset linkset
@ -192,7 +193,6 @@ echo -----------------------------------------------
echo -e "\033[33m仅限导入完整clash链接\033[0m" echo -e "\033[33m仅限导入完整clash链接\033[0m"
echo -e "可以使用\033[32m https://acl4ssr.netlify.app \033[0m在线转换" echo -e "可以使用\033[32m https://acl4ssr.netlify.app \033[0m在线转换"
echo -e "\033[36m导入后如无法运行请使用【导入节点/订阅链接】功能" echo -e "\033[36m导入后如无法运行请使用【导入节点/订阅链接】功能"
echo -e "\033[31m注意如节点使用了chacha20加密协议需将核心更新为clashr核心\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
echo -e "\033[33m0 返回上级菜单\033[0m" echo -e "\033[33m0 返回上级菜单\033[0m"
echo ----------------------------------------------- echo -----------------------------------------------
@ -305,7 +305,6 @@ cpucore=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]')
[ -n "$(echo $cpucore | grep -E "linux.*armv7.*")" ] && cpucore="armv7" [ -n "$(echo $cpucore | grep -E "linux.*armv7.*")" ] && cpucore="armv7"
[ -n "$(echo $cpucore | grep -E "linux.*mips.*")" ] && cpucore="mipsle-softfloat" [ -n "$(echo $cpucore | grep -E "linux.*mips.*")" ] && cpucore="mipsle-softfloat"
[ -n "$(echo $cpucore | grep -E "linux.*x86.*")" ] && cpucore="386" [ -n "$(echo $cpucore | grep -E "linux.*x86.*")" ] && cpucore="386"
[ -n "$(echo $cpucore | grep -E "linux.*amd64.*")" ] && cpucore="amd64"
[ -n "$(echo $cpucore | grep -E "linux.*x86_64.*")" ] && cpucore="amd64" [ -n "$(echo $cpucore | grep -E "linux.*x86_64.*")" ] && cpucore="amd64"
### ###
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -115,19 +115,6 @@ else
echo 配置文件已生成正在启动clash使其生效 echo 配置文件已生成正在启动clash使其生效
#重启clash服务 #重启clash服务
$0 stop $0 stop
start_over(){
echo -e "\033[32mclash服务已启动\033[0m"
if [ -d /www/clash ];then
echo -e "请使用\033[30;47m http://$host/clash \033[0m管理内置规则"
elif [ -d $clashdir/ui ];then
echo -e "请使用\033[30;47m http://$host:9999/ui \033[0m管理内置规则"
else
echo -e "可使用\033[30;47m http://clash.razord.top \033[0m管理内置规则"
echo -e "Host地址:\033[36m $host \033[0m 端口:\033[36m 9999 \033[0m"
echo -e "也可前往更新菜单安装本地Dashboard面板连接更稳定\033[0m"
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fi
}
$0 start $0 start
sleep 1 sleep 1
if pidof clash >/dev/null;then if pidof clash >/dev/null;then
@ -146,8 +133,8 @@ else
fi fi
fi fi
echo -e "\033[31mclash服务启动失败请查看报错信息\033[0m" echo -e "\033[31mclash服务启动失败请查看报错信息\033[0m"
$clashdir/start.sh stop $0 stop
$clashdir/clash -d $clashdir & { sleep 3 ; kill $! & } $clashdir/clash -t -d $clashdir
exit; exit;
fi fi
else else
@ -287,14 +274,12 @@ start_dns(){
iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j clash_dns iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j clash_dns
#ipv6DNS #ipv6DNS
if [ "$ipv6_support" = "已开启" ];then ip6tables -t nat -N clash_dns > /dev/null 2>&1
ip6tables -t nat -N clash_dns > /dev/null 2>&1 for mac in $(cat $clashdir/mac); do
for mac in $(cat $clashdir/mac); do ip6tables -t nat -A clash_dns -m mac --mac-source $mac -j RETURN > /dev/null 2>&1
ip6tables -t nat -A clash_dns -m mac --mac-source $mac -j RETURN > /dev/null 2>&1 done
done ip6tables -t nat -A clash_dns -p udp --dport 53 -j REDIRECT --to 1053 > /dev/null 2>&1
ip6tables -t nat -A clash_dns -p udp --dport 53 -j REDIRECT --to 1053 > /dev/null 2>&1 ip6tables -t nat -A PREROUTING -p udp -j clash_dns > /dev/null 2>&1
ip6tables -t nat -A PREROUTING -p udp -j clash_dns > /dev/null 2>&1
fi
} }
checkcron(){ checkcron(){
[ -d /etc/crontabs/ ]&&cronpath="/etc/crontabs/root" [ -d /etc/crontabs/ ]&&cronpath="/etc/crontabs/root"
@ -365,4 +350,4 @@ daemon)
daemon daemon
;; ;;
esac esac
exit 0 #exit 0