mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-01 01:44:15 +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
|
@ -40,4 +40,8 @@ type Context interface {
|
|||
|
||||
// GetSkipDNSResolve returns a flag switch for weather skip dns resolve during route pick.
|
||||
GetSkipDNSResolve() bool
|
||||
|
||||
GetUid() uint32
|
||||
|
||||
GetAppStatus() []string
|
||||
}
|
||||
|
|
|
@ -122,6 +122,21 @@ func (ctx *Context) GetSkipDNSResolve() bool {
|
|||
return ctx.Content.SkipDNSResolve
|
||||
}
|
||||
|
||||
// GetUid implements routing.Context.
|
||||
func (ctx *Context) GetUid() uint32 {
|
||||
if ctx.Inbound == nil {
|
||||
return 0
|
||||
}
|
||||
return ctx.Inbound.Uid
|
||||
}
|
||||
|
||||
func (ctx *Context) GetAppStatus() []string {
|
||||
if ctx.Inbound == nil {
|
||||
return nil
|
||||
}
|
||||
return ctx.Inbound.AppStatus
|
||||
}
|
||||
|
||||
// AsRoutingContext creates a context from context.context with session info.
|
||||
func AsRoutingContext(ctx context.Context) routing.Context {
|
||||
return &Context{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue