v2ray-core/app/dispatcher/dispatcher.go

20 lines
477 B
Go
Raw Normal View History

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