~调整meta内核mix模式过滤实现(geosite>rule-set数据库)
This commit is contained in:
3
.github/workflows/bin_update.yml
vendored
3
.github/workflows/bin_update.yml
vendored
@@ -110,7 +110,7 @@ jobs:
|
||||
run: |
|
||||
cd bin
|
||||
source version
|
||||
curl -kfSL -o geodata/Country.mmdb https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb
|
||||
#curl -kfSL -o geodata/Country.mmdb https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb
|
||||
curl -kfSL -o geodata/cn_mini.mmdb https://raw.githubusercontent.com/Hackl0us/GeoIP2-CN/release/Country.mmdb
|
||||
curl -kfSL -o geodata/china_ip_list.txt https://raw.githubusercontent.com/ChanthMiao/China-IPv4-List/release/cn.txt
|
||||
curl -kfSL -o geodata/china_ipv6_list.txt https://raw.githubusercontent.com/ChanthMiao/China-IPv6-List/release/cn6.txt
|
||||
@@ -119,6 +119,7 @@ jobs:
|
||||
curl -kfSL -o geodata/geosite_cn.db https://github.com/DustinWin/ruleset_geodata/releases/download/sing-box/geosite-lite.db
|
||||
curl -kfSL -o geodata/srs_geoip_cn.srs https://github.com/DustinWin/ruleset_geodata/releases/download/sing-box-ruleset/cnip.srs
|
||||
curl -kfSL -o geodata/srs_geosite_cn.srs https://github.com/DustinWin/ruleset_geodata/releases/download/sing-box-ruleset/cn.srs
|
||||
curl -kfSL -o geodata/mrs_geosite_cn.mrs https://github.com/DustinWin/ruleset_geodata/releases/download/clash-ruleset/cn.mrs
|
||||
mv -f ../ca-bundle.crt ./fix/ca-certificates.crt
|
||||
sed -i "s/GeoIP_v=.*/GeoIP_v=$(date '+%Y%m%d')/" version #修改版本号
|
||||
echo 数据库及根证书文件更新完成!
|
||||
|
||||
@@ -386,7 +386,7 @@ dns:
|
||||
EOF
|
||||
if [ "$dns_mod" != "redir_host" ]; then
|
||||
cat "$CRASHDIR"/configs/fake_ip_filter "$CRASHDIR"/configs/fake_ip_filter.list 2>/dev/null | grep '\.' | sed "s/^/ - '/" | sed "s/$/'/" >>"$TMPDIR"/dns.yaml
|
||||
[ "$dns_mod" = "mix" ] && echo ' - "geosite:CN"' >>"$TMPDIR"/dns.yaml
|
||||
[ "$dns_mod" = "mix" ] && echo ' - "rule-set:geosite-cn"' >>"$TMPDIR"/dns.yaml #插入cn过滤规则
|
||||
else
|
||||
echo " - '+.*'" >>"$TMPDIR"/dns.yaml #使用fake-ip模拟redir_host
|
||||
fi
|
||||
@@ -517,6 +517,14 @@ EOF
|
||||
cat "$TMPDIR"/rules.yaml >>"$TMPDIR"/rules.add
|
||||
mv -f "$TMPDIR"/rules.add "$TMPDIR"/rules.yaml
|
||||
}
|
||||
#mix模式生成rule-providers
|
||||
[ "$dns_mod" = "mix" ] && ! grep -q 'geosite-cn' "$TMPDIR"/rule-providers.yaml && cat >>"$TMPDIR"/rule-providers.yaml <<EOF
|
||||
geosite-cn:
|
||||
type: file
|
||||
behavior: domain
|
||||
format: mrs
|
||||
path: geosite-cn.mrs
|
||||
EOF
|
||||
#对齐rules中的空格
|
||||
sed -i 's/^ *-/ -/g' "$TMPDIR"/rules.yaml
|
||||
#合并文件
|
||||
@@ -1742,6 +1750,8 @@ clash_check() { #clash启动前检查
|
||||
[ -n "$(cat "$CRASHDIR"/yamls/*.yaml | grep -oEi 'geoip')" ] && ckgeo Country.mmdb cn_mini.mmdb
|
||||
#预下载GeoSite数据库
|
||||
[ -n "$(cat "$CRASHDIR"/yamls/*.yaml | grep -oEi 'geosite')" ] && ckgeo GeoSite.dat geosite.dat
|
||||
#预下载geosite-cn.mrs数据库
|
||||
[ -n "$(cat "$CRASHDIR"/yamls/*.yaml | grep -oEi 'rule_set.*geosite-cn')" -o "$dns_mod" = "mix" ] && ckgeo geosite-cn.mrs mrs_geosite_cn.mrs
|
||||
return 0
|
||||
}
|
||||
singbox_check() { #singbox启动前检查
|
||||
|
||||
@@ -1687,15 +1687,15 @@ setgeo(){ #数据库选择菜单
|
||||
echo -e " 2 CN-IPV6绕过文件(约30kb) \033[33m$china_ipv6_list_v\033[0m"
|
||||
}
|
||||
[ -z "$(echo "$crashcore" | grep sing)" ] && {
|
||||
echo -e " 3 Clash全球版GeoIP数据库(约6mb) \033[33m$Country_v\033[0m"
|
||||
echo -e " 4 Clash精简版GeoIP_cn数据库(约0.1mb) \033[33m$cn_mini_v\033[0m"
|
||||
echo -e " 5 Meta完整版GeoSite数据库(约5mb) \033[33m$geosite_v\033[0m"
|
||||
echo -e " 3 Clash精简版GeoIP_cn数据库(约0.1mb) \033[33m$cn_mini_v\033[0m"
|
||||
echo -e " 4 Meta完整版GeoSite数据库(约5mb) \033[33m$geosite_v\033[0m"
|
||||
echo -e " 5 geosite-cn.mrs数据库(DNS分流,约0.5mb) \033[33m$mrs_geosite_cn_v\033[0m"
|
||||
}
|
||||
[ -n "$(echo "$crashcore" | grep sing)" ] && {
|
||||
echo -e " 6 SingBox精简版GeoIP_cn数据库(约0.3mb) \033[33m$geoip_cn_v\033[0m"
|
||||
echo -e " 7 SingBox精简版GeoSite数据库(约0.8mb) \033[33m$geosite_cn_v\033[0m"
|
||||
echo -e " 8 Rule_Set_geoip_cn数据库(约0.1mb) \033[33m$srs_geoip_cn_v\033[0m"
|
||||
echo -e " 9 Rule_Set_geosite_cn数据库(约0.1mb) \033[33m$srs_geosite_cn_v\033[0m"
|
||||
echo -e " 8 geoip-cn.srs数据库(约0.1mb) \033[33m$srs_geoip_cn_v\033[0m"
|
||||
echo -e " 9 geosite-cn.srs数据库(DNS分流,约0.5mb) \033[33m$srs_geosite_cn_v\033[0m"
|
||||
}
|
||||
echo -----------------------------------------------
|
||||
echo -e " a \033[32m自定义数据库文件\033[0m"
|
||||
@@ -1719,23 +1719,23 @@ setgeo(){ #数据库选择菜单
|
||||
setgeo
|
||||
;;
|
||||
3)
|
||||
geotype=Country.mmdb
|
||||
geoname=Country.mmdb
|
||||
getgeo
|
||||
setgeo
|
||||
;;
|
||||
4)
|
||||
geotype=cn_mini.mmdb
|
||||
geoname=Country.mmdb
|
||||
getgeo
|
||||
setgeo
|
||||
;;
|
||||
5)
|
||||
4)
|
||||
geotype=geosite.dat
|
||||
geoname=GeoSite.dat
|
||||
getgeo
|
||||
setgeo
|
||||
;;
|
||||
5)
|
||||
geotype=mrs_geosite_cn.mrs
|
||||
geoname=geosite-cn.mrs
|
||||
getgeo
|
||||
setgeo
|
||||
;;
|
||||
6)
|
||||
geotype=geoip_cn.db
|
||||
geoname=geoip.db
|
||||
|
||||
Reference in New Issue
Block a user