interface for inbound connection handler manager

This commit is contained in:
v2ray committed 2016-01-01 23:44:11 +01:00
1 parent 6344369eb4
commit 3baa1f5bc5
24 files changed
+269 -167

No files matched your search

+6 -8
View File
@@ -2,16 +2,14 @@ package socks
import (
"github.com/v2ray/v2ray-core/app"
"github.com/v2ray/v2ray-core/proxy"
"github.com/v2ray/v2ray-core/proxy/common/connhandler"
)
type SocksServerFactory struct {
}
func (this SocksServerFactory) Create(space app.Space, rawConfig interface{}) (connhandler.InboundConnectionHandler, error) {
return NewSocksServer(space, rawConfig.(Config)), nil
}
func init() {
connhandler.RegisterInboundConnectionHandlerFactory("socks", SocksServerFactory{})
if err := proxy.RegisterInboundConnectionHandlerFactory("socks", func(space app.Space, rawConfig interface{}) (connhandler.InboundConnectionHandler, error) {
return NewSocksServer(space, rawConfig.(Config)), nil
}); err != nil {
panic(err)
}
}