policy.go 424 B

1234567891011121314151617181920
  1. package policy
  2. import (
  3. "v2ray.com/core/app"
  4. )
  5. // Manager is an utility to manage policy per user level.
  6. type Manager interface {
  7. // GetPolicy returns the Policy for the given user level.
  8. GetPolicy(level uint32) Policy
  9. }
  10. // FromSpace returns the policy.Manager in a space.
  11. func FromSpace(space app.Space) Manager {
  12. app := space.GetApplication((*Manager)(nil))
  13. if app == nil {
  14. return nil
  15. }
  16. return app.(Manager)
  17. }