1
0
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:
Darien Raymond
2016-12-16 15:39:47 +01:00
parent 3ec82f5d32
commit 5e297692da
5 changed files with 87 additions and 2 deletions

View File

@@ -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{})
}