fix: Fix DOMAIN-REGEX parsing

This commit is contained in:
xishang0128 2024-03-29 13:43:11 +08:00
parent 11f0983e5c
commit 914bc8a3e9
No known key found for this signature in database
GPG Key ID: 44A1E10B5ADF68CB
2 changed files with 4 additions and 3 deletions

View File

@ -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 {

View File

@ -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:]