From 914bc8a3e9d6e8fcc83a0589b45af18bb0fc714f Mon Sep 17 00:00:00 2001 From: xishang0128 Date: Fri, 29 Mar 2024 13:43:11 +0800 Subject: [PATCH] fix: Fix `DOMAIN-REGEX` parsing --- config/config.go | 2 +- rules/provider/classical_strategy.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/config.go b/config/config.go index b2c8ec1621..c793157372 100644 --- a/config/config.go +++ b/config/config.go @@ -921,7 +921,7 @@ func parseRules(rulesConfig []string, proxies map[string]C.Proxy, subRules map[s l := len(rule) - if ruleName == "NOT" || ruleName == "OR" || ruleName == "AND" || ruleName == "SUB-RULE" { + if ruleName == "NOT" || ruleName == "OR" || ruleName == "AND" || ruleName == "SUB-RULE" || ruleName == "DOMAIN-REGEX" { target = rule[l-1] payload = strings.Join(rule[1:l-1], ",") } else { diff --git a/rules/provider/classical_strategy.go b/rules/provider/classical_strategy.go index f8042164aa..6a2dccd53e 100644 --- a/rules/provider/classical_strategy.go +++ b/rules/provider/classical_strategy.go @@ -2,9 +2,10 @@ package provider import ( "fmt" + "strings" + C "github.com/metacubex/mihomo/constant" "github.com/metacubex/mihomo/log" - "strings" ) type classicalStrategy struct { @@ -76,7 +77,7 @@ func ruleParse(ruleRaw string) (string, string, []string) { } else if len(item) == 2 { return item[0], item[1], nil } else if len(item) > 2 { - if item[0] == "NOT" || item[0] == "OR" || item[0] == "AND" || item[0] == "SUB-RULE" { + if item[0] == "NOT" || item[0] == "OR" || item[0] == "AND" || item[0] == "SUB-RULE" || item[0] == "DOMAIN-REGEX" { return item[0], strings.Join(item[1:len(item)], ","), nil } else { return item[0], item[1], item[2:]