simplify connection handler registration

This commit is contained in:
v2ray committed 2016-01-06 16:23:54 +01:00
1 parent 350b31cad9
commit 5b1854f842
10 files changed
+59 -52

No files matched your search

+4 -3
View File
@@ -249,9 +249,10 @@ func TestSocksUdpSend(t *testing.T) {
ConnOutput: connOutput,
}
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och", func(space app.Space, config interface{}) (v2proxy.OutboundConnectionHandler, error) {
return och, nil
})
protocol, err := proxytesting.RegisterOutboundConnectionHandlerCreator("mock_och",
func(space app.Space, config interface{}) (v2proxy.OutboundConnectionHandler, error) {
return och, nil
})
assert.Error(err).IsNil()
config := mocks.Config{
+4 -5
View File
@@ -7,9 +7,8 @@ import (
)
func init() {
if err := internal.RegisterInboundConnectionHandlerFactory("socks", func(space app.Space, rawConfig interface{}) (proxy.InboundConnectionHandler, error) {
return NewSocksServer(space, rawConfig.(Config)), nil
}); err != nil {
panic(err)
}
internal.MustRegisterInboundConnectionHandlerCreator("socks",
func(space app.Space, rawConfig interface{}) (proxy.InboundConnectionHandler, error) {
return NewSocksServer(space, rawConfig.(Config)), nil
})
}