dispatcher.go 497 B

1234567891011121314151617181920212223
  1. package dispatcher
  2. import (
  3. "context"
  4. "v2ray.com/core/app"
  5. "v2ray.com/core/common/net"
  6. "v2ray.com/core/transport/ray"
  7. )
  8. // Interface dispatch a packet and possibly further network payload to its destination.
  9. type Interface interface {
  10. Dispatch(ctx context.Context, dest net.Destination) (ray.InboundRay, error)
  11. Start() error
  12. Close()
  13. }
  14. func FromSpace(space app.Space) Interface {
  15. if app := space.GetApplication((*Interface)(nil)); app != nil {
  16. return app.(Interface)
  17. }
  18. return nil
  19. }