diff --git a/scripts/clash.sh b/scripts/clash.sh index 4b90236..f8dc45e 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -135,13 +135,15 @@ checkrestart(){ #功能相关 log_pusher(){ [ -n "$push_TG" ] && stat_TG=32m已启用 || stat_TG=33m未启用 + [ -n "$push_Deer" ] && stat_Deer=32m已启用 || stat_Deer=33m未启用 [ -n "$push_bark" ] && stat_bark=32m已启用 || stat_bark=33m未启用 [ -n "$push_Po" ] && stat_Po=32m已启用 || stat_Po=33m未启用 echo ----------------------------------------------- echo -e " 1 查看\033[36m运行日志\033[0m" echo -e " 2 Telegram推送 ——\033[$stat_TG\033[0m" - echo -e " 3 Bark推送-IOS ——\033[$stat_bark\033[0m" - echo -e " 4 Passover推送 ——\033[$stat_Po\033[0m" + echo -e " 3 PushDeer推送 ——\033[$stat_Deer\033[0m" + echo -e " 4 Bark推送-IOS ——\033[$stat_bark\033[0m" + echo -e " 5 Passover推送 ——\033[$stat_Po\033[0m" echo ----------------------------------------------- read -p "请输入对应数字 > " num case $num in @@ -193,6 +195,33 @@ log_pusher(){ log_pusher ;; 3) + echo ----------------------------------------------- + if [ -n "$push_Deer" ];then + read -p "确认关闭PushDeer日志推送?(1/0) > " res + [ "$res" = 1 ] && { + push_Deer= + setconfig push_Deer + } + else + #echo -e "\033[33m详细设置指南请参考 https://juewuy.github.io/ \033[0m" + echo -e "请先前往 \033[32;4mhttp://www.pushdeer.com/official.html\033[0m 扫码安装快应用或下载APP" + echo -e "打开快应用/APP,并完成登陆" + echo -e "\033[33m切换到「设备」标签页,点击右上角的加号,注册当前设备\033[0m" + echo -e "\033[36m切换到「秘钥」标签页,点击右上角的加号,创建一个秘钥,并复制\033[0m" + echo ----------------------------------------------- + read -p "请输入你复制的秘钥 > " url + if [ -n "$url" ];then + push_Deer=$url + setconfig push_Deer $url + $clashdir/start.sh logger "已完成PushDeer日志推送设置!" 32 + else + echo -e "\033[31m输入错误,请重新输入!\033[0m" + fi + sleep 1 + fi + log_pusher + ;; + 4) echo ----------------------------------------------- if [ -n "$push_bark" ];then read -p "确认关闭Bark日志推送?(1/0) > " res @@ -217,7 +246,7 @@ log_pusher(){ fi log_pusher ;; - 4) + 5) echo ----------------------------------------------- if [ -n "$push_Po" ];then read -p "确认关闭Pushover日志推送?(1/0) > " res diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 23e2299..3f24145 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -256,10 +256,16 @@ clashlink(){ elif [ "$num" = 2 ];then echo ----------------------------------------------- - echo -e "\033[33m此功能可能会导致严重bug,仅限熟练了解clash运行机制的用户使用!!!\033[0m" - echo -e "如你不熟悉clash机制或者使用此功能出现bug,请使用\033[32m在线生成配置文件功能!\033[0m" + echo -e "\033[33m此功能可能会导致严重bug!!!\033[0m" + sleep 1 echo ----------------------------------------------- - read -p "是否继续?[1/0] > " res + echo -e "强烈建议你使用\033[32m在线生成配置文件功能!\033[0m" + sleep 1 + echo ----------------------------------------------- + echo -e "\033[33m继续后如出现任何问题,请务必自行解决,一切提问恕不受理!\033[0m" + echo ----------------------------------------------- + sleep 2 + read -p "我确认遇到问题可以自行解决[1/0] > " res if [ "$res" = '1' ]; then getlink2 else diff --git a/scripts/start.sh b/scripts/start.sh index 3c92381..743e85e 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -74,6 +74,14 @@ logger(){ wget -Y on -q --timeout=3 -t 1 "$url" fi } + [ -n "$push_Deer" ] && { + url=https://api2.pushdeer.com/message/push?pushkey=${push_Deer} + if curl --version &> /dev/null;then + curl -kfsSl --connect-timeout 3 "$url"\&text="$log_text" &>/dev/null + else + wget -Y on -q --timeout=3 -t 1 "$url"\&text="$log_text" + fi + } [ -n "$push_Po" ] && { url=https://api.pushover.net/1/messages.json curl -kfsSl --connect-timeout 3 --form-string "token=$push_Po" --form-string "user=$push_Po_key" --form-string "message=$log_text" "$url" &>/dev/null @@ -474,6 +482,7 @@ start_redir(){ iptables -t nat -A PREROUTING -p tcp $ports -j clash #设置ipv6转发 if [ "$ipv6_redir" = "已开启" -a -n "$(lsmod | grep 'ip6table_nat')" ];then + ip6tables -t nat -N clashv6 ip6tables -t nat -A clashv6 -d ::1/128 -j RETURN ip6tables -t nat -A clashv6 -d fc00::/7 -j RETURN @@ -488,6 +497,7 @@ start_redir(){ for mac in $(cat $clashdir/mac); do ip6tables -t nat -A clashv6 -m mac --mac-source $mac -j RETURN done + [ -n "$wan_mac" ] && ip6tables -t nat -A clashv6 -m mac --mac-source $wan_mac -j RETURN #屏蔽本机出口网卡 ip6tables -t nat -A clashv6 -p tcp $ports -j REDIRECT --to-ports $redir_port fi ip6tables -t nat -A PREROUTING -p tcp -j clashv6 @@ -602,6 +612,7 @@ start_tproxy(){ for mac in $(cat $clashdir/mac); do ip6tables -t mangle -A clashv6 -m mac --mac-source $mac -j RETURN done + [ -n "$wan_mac" ] && ip6tables -t mangle -A clashv6 -m mac --mac-source $wan_mac -j RETURN #屏蔽本机出口网卡 ip6tables -t mangle -A clashv6 -p $1 -j TPROXY --on-port $tproxy_port --tproxy-mark 1 fi ip6tables -t mangle -A PREROUTING -p $1 $ports -j clashv6 @@ -765,6 +776,7 @@ start_nft(){ ip -6 rule add fwmark 1 table 101 2> /dev/null ip -6 route add local ::/0 dev lo table 101 2> /dev/null nft add rule inet shellclash prerouting ip6 daddr {${RESERVED_IP6}} return + [ -n "$wan_mac" ] && nft add rule inet shellclash prerouting ether saddr {${wan_mac}} return #屏蔽本机出口网卡 else nft add rule inet shellclash prerouting meta nfproto ipv6 return fi @@ -1130,6 +1142,7 @@ afstart(){ fi } #设置路由规则 + wan_mac=$(ifconfig wan | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}') [ "$redir_mod" = "Redir模式" ] && start_dns && start_redir [ "$redir_mod" = "混合模式" ] && start_dns && start_redir && start_tun udp [ "$redir_mod" = "Tproxy混合" ] && start_dns && start_redir && start_tproxy udp