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:
@@ -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,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user