From 119c0fab50741dcb65a18f8d155cdd1d98959bd2 Mon Sep 17 00:00:00 2001 From: DustinWin <45238096+DustinWin@users.noreply.github.com> Date: Sat, 13 Apr 2024 21:30:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20fake=5Fip=5Ffilter.list=20?= =?UTF-8?q?=E9=80=82=E9=85=8D=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=B0=BD=E9=87=8F?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20`domain`=20=E5=92=8C=20`domain=5Fsuffix`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fake_ip_filter.list 仅中间区域带有 `*` 的域名使用 `domain_regex` 规则类型 --- scripts/start.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 600238e20..1d1f9f814 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -592,13 +592,21 @@ EOF } [ "$dns_mod" = "fake-ip" ] && { global_dns=dns_fakeip - fake_ip_filter=$(cat "$CRASHDIR"/configs/fake_ip_filter "$CRASHDIR"/configs/fake_ip_filter.list 2>/dev/null | grep '\.' | awk '{printf "\"%s\", ",$1}' | sed "s/, $//" | sed 's/+/.+/g' | sed 's/*/.*/g') - [ -n "$fake_ip_filter" ] && fake_ip_filter="{ \"domain_regex\": [$fake_ip_filter], \"server\": \"dns_direct\" }," + fake_ip_filter_domain=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep -Ev '#|\+|\*|Mijia' | sed '/^\s*$/d' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') + fake_ip_filter_suffix=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep -Ev '#|.\*' | grep -E '\*|\+' | awk '{sub(/^[*+]\./,""); print} {print "."$0}' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') + fake_ip_filter_regex=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep '.\*' | sed 's/^*/.\*/' | sed 's/^+/.\+/' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') + [ -n "$fake_ip_filter_domain" ] && fake_ip_filter_domain="{ \"domain\": [$fake_ip_filter_domain], \"server\": \"dns_direct\" }," + [ -n "$fake_ip_filter_suffix" ] && fake_ip_filter_suffix="{ \"domain_suffix\": [$fake_ip_filter_suffix], \"server\": \"dns_direct\" }," + [ -n "$fake_ip_filter_regex" ] && fake_ip_filter_regex="{ \"domain_regex\": [$fake_ip_filter_regex], \"server\": \"dns_direct\" }," } [ "$dns_mod" = "mix" ] && { global_dns=dns_fakeip - fake_ip_filter=$(cat "$CRASHDIR"/configs/fake_ip_filter 2>/dev/null | grep '\.' | awk '{printf "\"%s\", ",$1}' | sed "s/, $//" | sed 's/\"+/\".+/g' | sed 's/\"\*/\".*/g') - [ -n "$fake_ip_filter" ] && fake_ip_filter="{ \"domain_regex\": [$fake_ip_filter], \"server\": \"dns_direct\" }," + fake_ip_filter_domain=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep -Ev '#|\+|\*|Mijia' | sed '/^\s*$/d' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') + fake_ip_filter_suffix=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep -Ev '#|.\*' | grep -E '\*|\+' | awk '{sub(/^[*+]\./,""); print} {print "."$0}' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') + fake_ip_filter_regex=$(cat ${CRASHDIR}/configs/fake_ip_filter ${CRASHDIR}/configs/fake_ip_filter.list 2>/dev/null | grep '.\*' | sed 's/^*/.\*/' | sed 's/^+/.\+/' | awk '{printf "\"%s\", ",$1}' | sed 's/, $//') + [ -n "$fake_ip_filter_domain" ] && fake_ip_filter_domain="{ \"domain\": [$fake_ip_filter_domain], \"server\": \"dns_direct\" }," + [ -n "$fake_ip_filter_suffix" ] && fake_ip_filter_suffix="{ \"domain_suffix\": [$fake_ip_filter_suffix], \"server\": \"dns_direct\" }," + [ -n "$fake_ip_filter_regex" ] && fake_ip_filter_regex="{ \"domain_regex\": [$fake_ip_filter_regex], \"server\": \"dns_direct\" }," if [ -z "$(echo "$core_v" | grep -E '^1\.7.*')" ]; then direct_dns="{ \"rule_set\": [\"geosite-cn\"], \"server\": \"dns_direct\" }," #生成add_rule_set.json @@ -645,7 +653,9 @@ EOF { "outbound": ["any"], "server": "dns_direct" }, { "clash_mode": "Global", "server": "$global_dns", "rewrite_ttl": 1 }, { "clash_mode": "Direct", "server": "dns_direct" }, - $fake_ip_filter + $fake_ip_filter_domain + $fake_ip_filter_suffix + $fake_ip_filter_regex $direct_dns { "query_type": [ "A", "AAAA" ], "server": "dns_fakeip", "rewrite_ttl": 1 } ],