From cf9bd817de036de4ae21de7e50619e65a6411940 Mon Sep 17 00:00:00 2001 From: giveup Date: Sun, 1 Oct 2023 20:21:32 +0800 Subject: [PATCH] increase ipset maxelem size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用自定义cnip时, 调整创建ipset list的大小 --- scripts/start.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 54ccdc7..a2d1827 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -494,7 +494,8 @@ cn_ip_route(){ fi } [ -f $bindir/cn_ip.txt -a -z "$(echo $redir_mod|grep 'Nft')" ] && { - echo "create cn_ip hash:net family inet hashsize 1024 maxelem 65536" > $TMPDIR/cn_$USER.ipset + # see https://raw.githubusercontent.com/Hackl0us/GeoIP2-CN/release/CN-ip-cidr.txt + echo "create cn_ip hash:net family inet hashsize 10240 maxelem 10240" > $TMPDIR/cn_$USER.ipset awk '!/^$/&&!/^#/{printf("add cn_ip %s'" "'\n",$0)}' $bindir/cn_ip.txt >> $TMPDIR/cn_$USER.ipset ipset -! flush cn_ip 2>/dev/null ipset -! restore < $TMPDIR/cn_$USER.ipset @@ -513,7 +514,8 @@ cn_ipv6_route(){ } [ -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" > $TMPDIR/cn6_$USER.ipset + #see https://ispip.clang.cn/all_cn_ipv6.txt + echo "create cn_ip6 hash:net family inet6 hashsize 2048 maxelem 2048" > $TMPDIR/cn6_$USER.ipset awk '!/^$/&&!/^#/{printf("add cn_ip6 %s'" "'\n",$0)}' $bindir/cn_ipv6.txt >> $TMPDIR/cn6_$USER.ipset ipset -! flush cn_ip6 2>/dev/null ipset -! restore < $TMPDIR/cn6_$USER.ipset