mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-02 23:35:40 -05:00
decouple core and dispatcher impl
This commit is contained in:
@@ -2,12 +2,14 @@ package impl
|
||||
|
||||
import (
|
||||
"v2ray.com/core/app"
|
||||
"v2ray.com/core/app/dispatcher"
|
||||
"v2ray.com/core/app/proxyman"
|
||||
"v2ray.com/core/app/router"
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/errors"
|
||||
"v2ray.com/core/common/log"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/transport/ray"
|
||||
)
|
||||
@@ -81,3 +83,17 @@ func (v *DefaultDispatcher) FilterPacketAndDispatch(destination v2net.Destinatio
|
||||
}
|
||||
dispatcher.Dispatch(destination, payload, link)
|
||||
}
|
||||
|
||||
type DefaultDispatcherFactory struct{}
|
||||
|
||||
func (v DefaultDispatcherFactory) Create(space app.Space, config interface{}) (app.Application, error) {
|
||||
return NewDefaultDispatcher(space), nil
|
||||
}
|
||||
|
||||
func (v DefaultDispatcherFactory) AppId() app.ID {
|
||||
return dispatcher.APP_ID
|
||||
}
|
||||
|
||||
func init() {
|
||||
app.RegisterApplicationFactory(serial.GetMessageType(new(dispatcher.Config)), DefaultDispatcherFactory{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user