v2ray-core/app/policy/policy.go

21 lines
424 B
Go
Raw Normal View History

2017-11-27 21:09:30 +00:00
package policy
import (
"v2ray.com/core/app"
)
2017-11-27 21:18:39 +00:00
// Manager is an utility to manage policy per user level.
type Manager interface {
// GetPolicy returns the Policy for the given user level.
2017-11-27 21:09:30 +00:00
GetPolicy(level uint32) Policy
}
2017-11-27 21:18:39 +00:00
// FromSpace returns the policy.Manager in a space.
func FromSpace(space app.Space) Manager {
app := space.GetApplication((*Manager)(nil))
2017-11-27 21:09:30 +00:00
if app == nil {
return nil
}
2017-11-27 21:18:39 +00:00
return app.(Manager)
2017-11-27 21:09:30 +00:00
}