mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
424 B
21 lines
424 B
package policy
|
|
|
|
import (
|
|
"v2ray.com/core/app"
|
|
)
|
|
|
|
// Manager is an utility to manage policy per user level.
|
|
type Manager interface {
|
|
// GetPolicy returns the Policy for the given user level.
|
|
GetPolicy(level uint32) Policy
|
|
}
|
|
|
|
// FromSpace returns the policy.Manager in a space.
|
|
func FromSpace(space app.Space) Manager {
|
|
app := space.GetApplication((*Manager)(nil))
|
|
if app == nil {
|
|
return nil
|
|
}
|
|
return app.(Manager)
|
|
}
|