dispatcher.go 447 B

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