inbound.go 880 B

1234567891011121314151617181920212223242526272829303132333435
  1. package inbound
  2. import (
  3. "context"
  4. "v2ray.com/core/common"
  5. "v2ray.com/core/common/net"
  6. "v2ray.com/core/features"
  7. )
  8. // Handler is the interface for handlers that process inbound connections.
  9. type Handler interface {
  10. common.Runnable
  11. // The tag of this handler.
  12. Tag() string
  13. // Deprecated. Do not use in new code.
  14. GetRandomInboundProxy() (interface{}, net.Port, int)
  15. }
  16. // Manager is a feature that manages InboundHandlers.
  17. type Manager interface {
  18. features.Feature
  19. // GetHandlers returns an InboundHandler for the given tag.
  20. GetHandler(ctx context.Context, tag string) (Handler, error)
  21. // AddHandler adds the given handler into this Manager.
  22. AddHandler(ctx context.Context, handler Handler) error
  23. // RemoveHandler removes a handler from Manager.
  24. RemoveHandler(ctx context.Context, tag string) error
  25. }
  26. func ManagerType() interface{} {
  27. return (*Manager)(nil)
  28. }