mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-01-08 10:23:43 +08:00
feat: uid rule support for logic and rule-set
This commit is contained in:
parent
948700eed6
commit
79469fc8d6
@ -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…
x
Reference in New Issue
Block a user