refactor app.Space

This commit is contained in:
v2ray committed 2016-01-31 17:01:28 +01:00
1 parent fcf8a74a3a
commit 2031c13a7f
40 files changed
+484 -477

No files matched your search

+7 -1
View File
@@ -2,6 +2,7 @@ package socks
import (
"github.com/v2ray/v2ray-core/app"
"github.com/v2ray/v2ray-core/app/dispatcher"
"github.com/v2ray/v2ray-core/proxy"
"github.com/v2ray/v2ray-core/proxy/internal"
)
@@ -9,6 +10,11 @@ import (
func init() {
internal.MustRegisterInboundHandlerCreator("socks",
func(space app.Space, rawConfig interface{}) (proxy.InboundHandler, error) {
return NewSocksServer(space, rawConfig.(*Config)), nil
if !space.HasApp(dispatcher.APP_ID) {
return nil, internal.ErrorBadConfiguration
}
return NewSocksServer(
rawConfig.(*Config),
space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)), nil
})
}