Skip to content

Commit

Permalink
fix: Fix DOMAIN-REGEX parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
xishang0128 committed Mar 29, 2024
1 parent 11f0983 commit 914bc8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions rules/provider/classical_strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package provider

import (
"fmt"
"strings"

C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/log"
"strings"
)

type classicalStrategy struct {
Expand Down Expand Up @@ -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:]
Expand Down

0 comments on commit 914bc8a

Please sign in to comment.