mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-04 04:47:30 +00:00
chore: rebuild rule parsing code
This commit is contained in:
@@ -10,6 +10,10 @@ import (
|
||||
)
|
||||
|
||||
func ParseRule(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error) {
|
||||
if tp != "MATCH" && payload == "" { // only MATCH allowed doesn't contain payload
|
||||
return nil, fmt.Errorf("missing subsequent parameters: %s", tp)
|
||||
}
|
||||
|
||||
switch tp {
|
||||
case "DOMAIN":
|
||||
parsed = RC.NewDomain(payload, target)
|
||||
@@ -83,8 +87,6 @@ func ParseRule(tp, payload, target string, params []string, subRules map[string]
|
||||
case "MATCH":
|
||||
parsed = RC.NewMatch(target)
|
||||
parseErr = nil
|
||||
case "":
|
||||
parseErr = fmt.Errorf("missing subsequent parameters: %s", payload)
|
||||
default:
|
||||
parseErr = fmt.Errorf("unsupported rule type: %s", tp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user