mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-09 13:48:41 +00:00
Add uid and app status in routing rule
This commit is contained in:
parent
707efd6d12
commit
16d96aa54d
12 changed files with 429 additions and 133 deletions
|
@ -239,3 +239,11 @@ func (v *User) Build() *protocol.User {
|
|||
Level: uint32(v.LevelByte),
|
||||
}
|
||||
}
|
||||
|
||||
type UidList []uint32
|
||||
|
||||
func (l UidList) Build() *net.UidList {
|
||||
return &net.UidList{
|
||||
Uid: l,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -498,6 +498,8 @@ func parseFieldRule(msg json.RawMessage) (*router.RoutingRule, error) {
|
|||
InboundTag *StringList `json:"inboundTag"`
|
||||
Protocols *StringList `json:"protocol"`
|
||||
Attributes string `json:"attrs"`
|
||||
UidList *UidList `json:"uidList"`
|
||||
AppStatus *StringList `json:"appStatus"`
|
||||
}
|
||||
rawFieldRule := new(RawFieldRule)
|
||||
err := json.Unmarshal(msg, rawFieldRule)
|
||||
|
@ -593,6 +595,16 @@ func parseFieldRule(msg json.RawMessage) (*router.RoutingRule, error) {
|
|||
rule.Attributes = rawFieldRule.Attributes
|
||||
}
|
||||
|
||||
if rawFieldRule.UidList != nil && len(*rawFieldRule.UidList) > 0 {
|
||||
rule.UidList = rawFieldRule.UidList.Build()
|
||||
}
|
||||
|
||||
if rawFieldRule.AppStatus != nil && rawFieldRule.AppStatus.Len() > 0 {
|
||||
for _, s := range *rawFieldRule.AppStatus {
|
||||
rule.AppStatus = append(rule.AppStatus, s)
|
||||
}
|
||||
}
|
||||
|
||||
return rule, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue