mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-04-25 11:59:17 +00:00
~为mihomo的mix/route模式dns默认数据库增加每日自动同步
This commit is contained in:
@@ -55,8 +55,6 @@ EOF
|
||||
respect-rules: true
|
||||
nameserver-policy: {'rule-set:cn': [ $dns_nameserver ]}
|
||||
proxy-server-nameserver : [ $dns_proxy_server ]
|
||||
proxy-server-nameserver-policy:
|
||||
'+.cloud-nodes.com': '124.221.68.73:1053'
|
||||
nameserver: [ $dns_final ]
|
||||
EOF
|
||||
else
|
||||
@@ -203,12 +201,12 @@ add_custom_inbounds_and_rules() {
|
||||
}
|
||||
}
|
||||
|
||||
generate_rule_providers_and_merge_yaml() {
|
||||
merger_yaml() {
|
||||
#mix和route模式生成rule-providers
|
||||
[ "$dns_mod" = "mix" ] || [ "$dns_mod" = "route" ] && ! grep -Eq '^[[:space:]]*cn:' "$TMPDIR"/rule-providers.yaml && ! grep -q '^rule-providers' "$CRASHDIR"/yamls/others.yaml 2>/dev/null && {
|
||||
space=$(sed -n "1p" "$TMPDIR"/rule-providers.yaml | grep -oE '^ *') #获取空格数
|
||||
[ -z "$space" ] && space=' '
|
||||
echo "${space}cn: {type: http, behavior: domain, format: mrs, path: ./ruleset/cn.mrs, url: https://testingcf.jsdelivr.net/gh/juewuy/ShellCrash@update/bin/geodata/mrs_geosite_cn.mrs}" >>"$TMPDIR"/rule-providers.yaml
|
||||
echo "${space}cn: {type: http, behavior: domain, format: mrs, path: ./ruleset/cn.mrs, interval: 86400, url: https://testingcf.jsdelivr.net/gh/juewuy/ShellCrash@update/bin/geodata/mrs_geosite_cn.mrs}" >>"$TMPDIR"/rule-providers.yaml
|
||||
}
|
||||
#对齐rules中的空格
|
||||
sed -i 's/^ *-/ -/g' "$TMPDIR"/rules.yaml
|
||||
@@ -235,7 +233,7 @@ generate_rule_providers_and_merge_yaml() {
|
||||
cut -c 1- "$TMPDIR"/set.yaml $yaml_dns $yaml_hosts $yaml_user $yaml_others $yaml_add >"$TMPDIR"/config.yaml
|
||||
}
|
||||
|
||||
validate_and_rebuild_yaml_if_needed() {
|
||||
test_yaml() {
|
||||
#测试自定义配置文件
|
||||
"$TMPDIR"/CrashCore -t -d "$BINDIR" -f "$TMPDIR"/config.yaml >/dev/null
|
||||
if [ "$?" != 0 ]; then
|
||||
@@ -266,7 +264,7 @@ modify_yaml() {
|
||||
generate_set_and_hosts_yaml
|
||||
split_and_customize_yaml_parts
|
||||
add_custom_inbounds_and_rules
|
||||
generate_rule_providers_and_merge_yaml
|
||||
validate_and_rebuild_yaml_if_needed
|
||||
merger_yaml
|
||||
test_yaml
|
||||
finalize_clash_yaml
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user