inbound.go 848 B

12345678910111213141516171819202122232425262728293031
  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 InboundHandlerManager.
  22. AddHandler(ctx context.Context, handler Handler) error
  23. // RemoveHandler removes a handler from InboundHandlerManager.
  24. RemoveHandler(ctx context.Context, tag string) error
  25. }