fix: 类型转换错误导致规则解析错误

This commit is contained in:
adlyq 2022-06-02 15:43:27 +08:00
parent 6709936a8f
commit 3b038310ab
2 changed files with 5 additions and 1 deletions

View file

@ -5,6 +5,7 @@ import (
"github.com/Dreamacro/clash/common/collections"
C "github.com/Dreamacro/clash/constant"
RC "github.com/Dreamacro/clash/rule/common"
RP "github.com/Dreamacro/clash/rule/provider"
"github.com/Dreamacro/clash/rule/ruleparser"
"regexp"
"strings"
@ -70,6 +71,9 @@ func parseRule(tp, payload string, params []string) (parsed C.Rule, parseErr err
parsed, parseErr = NewOR(payload, "")
case "NOT":
parsed, parseErr = NewNOT(payload, "")
case "RULE-SET":
noResolve := RC.HasNoResolve(params)
parsed, parseErr = RP.NewRuleSet(payload, "", noResolve)
default:
parseErr = ruleparser.NewUnsupportedError(tp)
}

View file

@ -62,6 +62,6 @@ func NewUnsupportedError(tp any) *UnsupportedError {
}
func IsUnsupported(err error) bool {
_, ok := err.(UnsupportedError)
_, ok := err.(*UnsupportedError)
return ok
}