v1.0.0beta17.3

~新增自定义默认过滤端口功能
~屏蔽已被封禁的gitee下载源
~修复部分设备重启后代理失效的bug
~修复偶尔检测更新出错的bug
This commit is contained in:
juewuy
2020-12-08 20:37:49 +08:00
parent 09432eee01
commit 62c3566ac9
3 changed files with 35 additions and 14 deletions

View File

@@ -19,6 +19,7 @@ getconfig(){
[ -z "$redir_port" ] && redir_port=7892
[ -z "$db_port" ] && db_port=9999
[ -z "$dns_port" ] && dns_port=1053
[ -z "$multiport" ] && multiport='53,587,465,995,993,143,80,443'
[ -z "$local_proxy" ] && local_proxy=未开启
#检查mac地址记录
[ ! -f $clashdir/mac ] && touch $clashdir/mac
@@ -162,6 +163,7 @@ setport(){
echo -e " 4 修改DNS监听端口 \033[36m$dns_port\033[0m"
echo -e " 5 修改面板访问端口: \033[36m$db_port\033[0m"
echo -e " 6 设置面板访问密码: \033[36m$secret\033[0m"
echo -e " 7 修改默认端口过滤: \033[36m$multiport\033[0m"
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
if [ -z "$num" ]; then
@@ -214,6 +216,21 @@ setport(){
echo -e "\033[32m设置成功\033[0m"
fi
setport
elif [ "$num" = 7 ]; then
echo -----------------------------------------------
echo -e "需配合\033[32m仅代理常用端口\033[0m功能使用"
echo -e "多个端口请用小写逗号分隔,例如:\033[33m143,80,443\033[0m"
echo -e "输入 0 重置为默认端口"
echo -----------------------------------------------
read -p "请输入需要指定代理的端口 > " multiport
if [ -n "$multiport" ]; then
[ "$multiport" = "0" ] && multiport=""
common_ports=已开启
setconfig multiport $multiport
setconfig common_ports $common_ports
echo -e "\033[32m设置成功\033[0m"
fi
setport
fi
}
setdns(){
@@ -642,9 +659,9 @@ clashcfg(){
clashcfg
elif [ "$num" = 4 ]; then
echo -----------------------------------------------
echo -----------------------------------------------
if [ "$common_ports" = "未开启" ] > /dev/null 2>&1; then
echo -e "\033[33m已设为仅代理53,587,465,995,993,143,80,443等常用端口!!\033[0m"
echo -e "\033[33m已设为仅代理$multiport等常用端口!!\033[0m"
common_ports=已开启
else
echo -e "\033[33m已设为代理全部端口\033[0m"
@@ -686,8 +703,8 @@ clashadv(){
echo -e " 2 启用ipv6支持: \033[36m$ipv6_support\033[0m ————实验性功能,可能不稳定"
echo -e " 3 Redir模式udp转发: \033[36m$tproxy_mod\033[0m ————依赖iptables-mod-tproxy"
echo -e " 4 启用小闪存模式: \033[36m$mini_clash\033[0m ————启动时方下载核心及数据库文件"
echo -e " 5 配置内置DNS服务: \033[36m$dns_no\033[0m"
echo -e " 6 手动指定clash运行端口及秘钥"
echo -e " 5 配置内置DNS服务 \033[36m$dns_no\033[0m"
echo -e " 6 手动指定相关服务端口及秘钥"
echo -e " 7 使用自定义配置"
echo -----------------------------------------------
echo -e " 8 \033[31m重置\033[0m配置文件"

View File

@@ -671,7 +671,6 @@ setserver(){
echo -e " 1 Jsdelivr-CDN源(test版本)"
echo -e " 2 Jsdelivr-CDN源(release版本)"
echo -e " 3 Github源(test版本需开启clash服务)"
echo -e " 4 Gitee源(release版本可能滞后)"
echo -e " 5 自定义输入(请务必确保路径正确)"
echo -e " 6 切换版本(仅支持切换至release分支)"
echo -e " 0 返回上级菜单"
@@ -685,8 +684,6 @@ setserver(){
update_url='https://cdn.jsdelivr.net/gh/juewuy/ShellClash'
elif [ "$num" = 3 ]; then
update_url='https://raw.githubusercontent.com/juewuy/ShellClash/master'
elif [ "$num" = 4 ]; then
update_url='https://gitee.com/juewuy/ShellClash/raw/master'
elif [ "$num" = 5 ]; then
echo -----------------------------------------------
read -p "请输入个人源路径 > " update_url

View File

@@ -26,8 +26,9 @@ getconfig(){
[ -z "$dns_port" ] && dns_port=1053
[ -z "$dns_nameserver" ] && dns_nameserver='114.114.114.114, 223.5.5.5'
[ -z "$dns_fallback" ] && dns_fallback='1.0.0.1, 8.8.4.4'
[ -z "$multiport" ] && multiport='53,587,465,995,993,143,80,443'
#是否代理常用端口
[ "$common_ports" = "已开启" ] && ports='-m multiport --dports 53,587,465,995,993,143,80,443'
[ "$common_ports" = "已开启" ] && ports="-m multiport --dports $multiport"
}
setconfig(){
#参数1代表变量名参数2代表变量值,参数3即文件路径
@@ -436,8 +437,7 @@ web_restore(){
}
#设置循环检测clash面板端口
i=1
while [ $i -lt 10 ]
do
while [ $i -lt 10 ];do
sleep 1
if curl --version > /dev/null 2>&1;then
test=$(curl -s http://localhost:${db_port})
@@ -531,14 +531,21 @@ bfstart(){
fi
}
afstart(){
set_iptables(){
#设置循环检测iptables服务
i=1
while [ $i -lt 10 ];do
[ -n "$(iptables -L)" ] && i=10 || sleep 1
done
[ "$redir_mod" != "纯净模式" ] && [ "$dns_no" != "已禁用" ] && start_dns
[ "$redir_mod" != "纯净模式" ] && [ "$redir_mod" != "Tun模式" ] && start_redir
[ "$redir_mod" = "Redir模式" ] && [ "$tproxy_mod" = "已开启" ] && start_udp
}
#读取配置文件
getconfig
$bindir/clash -t -d $bindir >/dev/null
if [ "$?" = 0 ];then
#修改iptables规则使流量进入clash
[ "$redir_mod" != "纯净模式" ] && [ "$dns_no" != "已禁用" ] && start_dns
[ "$redir_mod" != "纯净模式" ] && [ "$redir_mod" != "Tun模式" ] && start_redir
[ "$redir_mod" = "Redir模式" ] && [ "$tproxy_mod" = "已开启" ] && start_udp
set_iptables & #后台检测及设置iptables
#标记启动时间
mark_time
#设置本机代理