feat: uid rule support for logic and rule-set
This commit is contained in:
parent
948700eed6
commit
79469fc8d6
2 changed files with 14 additions and 0 deletions
|
@ -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":
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue