mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-25 07:20:44 +00:00
simplify connection handler registration
This commit is contained in:
1 parent
350b31cad9
commit
5b1854f842
10 files changed
+59
-52
No files matched your search
@@ -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{
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user