dispatcher.go 473 B

123456789101112131415161718192021
  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. }
  12. func FromSpace(space app.Space) Interface {
  13. if app := space.GetApplication((*Interface)(nil)); app != nil {
  14. return app.(Interface)
  15. }
  16. return nil
  17. }