dispatcher.go 477 B

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