dispatcher.go 530 B

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