1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-02-20 23:47:21 -05:00

21 lines
530 B
Go
Raw Normal View History

2016-01-31 17:01:28 +01:00
package dispatcher
import (
2016-08-20 20:55:45 +02:00
"v2ray.com/core/app"
2017-01-06 15:32:36 +01:00
"v2ray.com/core/common/serial"
2016-08-20 20:55:45 +02:00
"v2ray.com/core/proxy"
"v2ray.com/core/transport/ray"
2016-01-31 17:01:28 +01:00
)
// PacketDispatcher dispatch a packet and possibly further network payload to its destination.
type PacketDispatcher interface {
2016-11-13 14:33:00 +01:00
DispatchToOutbound(session *proxy.SessionInfo) ray.InboundRay
2016-01-31 17:01:28 +01:00
}
2017-01-06 15:32:36 +01:00
func FromSpace(space app.Space) PacketDispatcher {
if app := space.(app.AppGetter).GetApp(serial.GetMessageType((*Config)(nil))); app != nil {
return app.(PacketDispatcher)
}
return nil
}