From 08cc386e19f992ea582f67e246c6a9f9c3336783 Mon Sep 17 00:00:00 2001 From: juewuy Date: Sun, 1 Jan 2023 20:59:56 +0800 Subject: [PATCH] =?UTF-8?q?v1.6.14b=20~=E5=A2=9E=E5=8A=A0=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=BB=95=E8=BF=87=E5=8A=9F=E8=83=BD=20~=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0nftables=E4=BE=9D=E8=B5=96=E6=A3=80=E6=B5=8B=E5=8F=8A?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=AE=89=E8=A3=85=E5=8A=9F=E8=83=BD(?= =?UTF-8?q?=E9=99=90OpenWrt)=20~=E4=BC=98=E5=8C=96=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91=20?= =?UTF-8?q?=E2=80=A6=E2=80=A6=E2=80=A6=E2=80=A6=20~=E5=A2=9E=E5=8A=A0CN-IP?= =?UTF-8?q?V6=E7=BB=95=E8=BF=87=E5=86=85=E6=A0=B8=E5=8A=9F=E8=83=BD(https:?= =?UTF-8?q?//github.com/juewuy/ShellClash/pull/294)=20~=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=BB=95=E8=BF=87bug=20~pre=E6=A0=B8redirhos?= =?UTF-8?q?t=E6=A8=A1=E5=BC=8F=E5=BC=BA=E5=88=B6=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E5=97=85=E6=8E=A2=20~=E6=96=B0=E6=89=8B?= =?UTF-8?q?=E5=BC=95=E5=AF=BC=E9=83=A8=E5=88=86=E4=BC=98=E5=8C=96=20~?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E7=94=9F=E6=88=90=E9=85=8D=E7=BD=AE=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/clash.sh | 2 +- scripts/getdate.sh | 15 +++++++++++++-- scripts/start.sh | 18 +++++++++--------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/scripts/clash.sh b/scripts/clash.sh index a451975..4c6c13f 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -521,7 +521,7 @@ setipv6(){ echo -e " 1 ipv6内核支持: \033[36m$ipv6_support\033[0m ——用于ipv6节点及规则支持" echo -e " 2 ipv6透明代理: \033[36m$ipv6_redir\033[0m ——代理ipv6流量" echo -e " 3 ipv6-DNS解析: \033[36m$ipv6_dns\033[0m ——决定内置DNS是否返回ipv6地址" - echo -e " 4 CN-ipv6绕过内核: \033[36m$cn_ipv6_route\033[0m ——优化性能,不兼容fake-ip" + echo -e " 4 CNIP绕过内核: \033[36m$cn_ipv6_route\033[0m ——优化性能,不兼容fake-ip" echo ----------------------------------------------- read -p "请输入对应数字 > " num case $num in diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 132260e..757f55d 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -558,9 +558,10 @@ setgeo(){ echo ----------------------------------------------- echo -e " 1 由\033[32malecthw\033[0m提供的全球版GeoIP数据库(约6mb)" echo -e " 2 由\033[32mHackl0us\033[0m提供的精简版CN-IP数据库(约0.2mb)" - echo -e " 3 由\033[32m17mon\033[0m提供的CN-IP文件(需启用CN_IP绕过内核功能,约0.2mb)" + echo -e " 3 由\033[32m17mon\033[0m提供的CN-IP文件(需启用CN_IP绕过,约0.2mb)" + echo -e " 4 由\033[32mChanthMiao\033[0m提供的CN-IPV6文件(需ipv6启用CN_IP绕过,约50kb)" [ "$clashcore" = "clash.meta" ] && \ - echo -e " 4 由\033[32mLoyalsoldier\033[0m提供的GeoSite数据库(限Meta内核,约4.5mb)" + echo -e " 5 由\033[32mLoyalsoldier\033[0m提供的GeoSite数据库(限Meta内核,约4.5mb)" echo " 0 返回上级菜单" echo ----------------------------------------------- read -p "请输入对应数字 > " num @@ -583,6 +584,16 @@ setgeo(){ sleep 1 fi elif [ "$num" = '4' ]; then + if [ "$cn_ipv6_route" = "已开启" -a "$ipv6_redir" = "已开启" ]; then + geotype=china_ipv6_list.txt + geoname=cn_ipv6.txt + getgeo + else + echo ----------------------------------------------- + echo -e "\033[31m未开启ipv6下CN绕过功能,无需更新CN-IPV6文件!!\033[0m" + sleep 1 + fi + elif [ "$num" = '5' ]; then geotype=geosite.dat geoname=geosite.dat getgeo diff --git a/scripts/start.sh b/scripts/start.sh index d1ef7c3..05aa6d6 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -456,19 +456,19 @@ cn_ip_route(){ } } cn_ipv6_route(){ - [ ! -f $bindir/china_ipv6_list.txt ] && { - if [ -f $clashdir/china_ipv6_list.txt ];then - mv $clashdir/china_ipv6_list.txt $bindir/china_ipv6_list.txt + [ ! -f $bindir/cn_ipv6.txt ] && { + if [ -f $clashdir/cn_ipv6.txt ];then + mv $clashdir/cn_ipv6.txt $bindir/cn_ipv6.txt else logger "未找到cn_ipv6列表,正在下载!" 33 - $0 webget $bindir/china_ipv6_list.txt "$update_url/bin/china_ipv6_list.txt" - [ "$?" = "1" ] && rm -rf $bindir/china_ipv6_list.txt && logger "列表下载失败!" 31 + $0 webget $bindir/cn_ipv6.txt "$update_url/bin/china_ipv6_list.txt" + [ "$?" = "1" ] && rm -rf $bindir/cn_ipv6.txt && logger "列表下载失败!" 31 fi } - [ -f $bindir/china_ipv6_list.txt -a -z "$(echo $redir_mod|grep 'Nft')" ] && { + [ -f $bindir/cn_ipv6.txt -a -z "$(echo $redir_mod|grep 'Nft')" ] && { #ipv6 echo "create cn_ip6 hash:net family inet6 hashsize 1024 maxelem 65536" > /tmp/cn6_$USER.ipset - awk '!/^$/&&!/^#/{printf("add cn_ip6 %s'" "'\n",$0)}' $bindir/china_ipv6_list.txt >> /tmp/cn6_$USER.ipset + awk '!/^$/&&!/^#/{printf("add cn_ip6 %s'" "'\n",$0)}' $bindir/cn_ipv6.txt >> /tmp/cn6_$USER.ipset ipset -! flush cn_ip6 2>/dev/null ipset -! restore < /tmp/cn6_$USER.ipset rm -rf cn6_$USER.ipset @@ -816,8 +816,8 @@ 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 - [ "$dns_mod" = "redir_host" -a "$cn_ipv6_route" = "已开启" -a -f $bindir/china_ipv6_list.txt ] && { - CN_IP6=$(awk '{printf "%s, ",$1}' $bindir/china_ipv6_list.txt) + [ "$dns_mod" = "redir_host" -a "$cn_ipv6_route" = "已开启" -a -f $bindir/cn_ipv6.txt ] && { + CN_IP6=$(awk '{printf "%s, ",$1}' $bindir/cn_ipv6.txt) [ -n "$CN_IP6" ] && nft add rule inet shellclash prerouting ip6 daddr {${CN_IP6}} return } [ -n "$ipv6_wan" ] && {