1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-25 06:59:13 -04:00

modulize dispatcher and proxyman

This commit is contained in:
v2ray
2016-05-17 23:05:52 -07:00
parent 09ea65687c
commit 7765fedd78
10 changed files with 167 additions and 213 deletions

View File

@@ -14,26 +14,3 @@ const (
type PacketDispatcher interface {
DispatchToOutbound(destination v2net.Destination) ray.InboundRay
}
type packetDispatcherWithContext interface {
DispatchToOutbound(context app.Context, destination v2net.Destination) ray.InboundRay
}
type contextedPacketDispatcher struct {
context app.Context
packetDispatcher packetDispatcherWithContext
}
func (this *contextedPacketDispatcher) DispatchToOutbound(destination v2net.Destination) ray.InboundRay {
return this.packetDispatcher.DispatchToOutbound(this.context, destination)
}
func init() {
app.Register(APP_ID, func(context app.Context, obj interface{}) interface{} {
packetDispatcher := obj.(packetDispatcherWithContext)
return &contextedPacketDispatcher{
context: context,
packetDispatcher: packetDispatcher,
}
})
}