diff --git a/rule/logic/common.go b/rule/logic/common.go index 89e62d76..18bdddf8 100644 --- a/rule/logic/common.go +++ b/rule/logic/common.go @@ -11,6 +11,7 @@ import ( "net/http" "os" "regexp" + "runtime" "strings" ) @@ -104,6 +105,12 @@ func parseRule(tp, payload string, params []string) (C.Rule, error) { case "RULE-SET": noResolve := RC.HasNoResolve(params) parsed, parseErr = provider.NewRuleSet(payload, "", noResolve) + case "UID": + if runtime.GOOS == "linux" || runtime.GOOS == "android" { + parsed, parseErr = RC.NewUid(payload, "") + } else { + parseErr = fmt.Errorf("uid rule not support this platform") + } case "IN-TYPE": parsed, parseErr = RC.NewInType(payload, "") case "NOT": diff --git a/rule/provider/parse.go b/rule/provider/parse.go index 206e55ef..f1604d46 100644 --- a/rule/provider/parse.go +++ b/rule/provider/parse.go @@ -7,6 +7,7 @@ import ( C "github.com/Dreamacro/clash/constant" P "github.com/Dreamacro/clash/constant/provider" RC "github.com/Dreamacro/clash/rule/common" + "runtime" "time" ) @@ -84,6 +85,12 @@ func parseRule(tp, payload, target string, params []string) (C.Rule, error) { parsed, parseErr = RC.NewProcess(payload, target, false) case "NETWORK": parsed, parseErr = RC.NewNetworkType(payload, target) + case "UID": + if runtime.GOOS == "linux" || runtime.GOOS == "android" { + parsed, parseErr = RC.NewUid(payload, target) + } else { + parseErr = fmt.Errorf("uid rule not support this platform") + } case "IN-TYPE": parsed, parseErr = RC.NewInType(payload, target) default: