1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-09-29 21:54:10 -04:00

simplify app design

This commit is contained in:
Darien Raymond
2017-01-06 15:32:36 +01:00
parent 13e4506781
commit b11d48d73f
27 changed files with 286 additions and 283 deletions

View File

@@ -6,9 +6,9 @@ import (
"v2ray.com/core/app"
"v2ray.com/core/app/dispatcher"
dispatchers "v2ray.com/core/app/dispatcher/impl"
_ "v2ray.com/core/app/dispatcher/impl"
"v2ray.com/core/app/proxyman"
"v2ray.com/core/app/proxyman/outbound"
_ "v2ray.com/core/app/proxyman/outbound"
"v2ray.com/core/common/dice"
v2net "v2ray.com/core/common/net"
"v2ray.com/core/proxy"
@@ -38,8 +38,10 @@ func TestDokodemoTCP(t *testing.T) {
defer tcpServer.Close()
space := app.NewSpace()
space.BindApp(dispatcher.APP_ID, dispatchers.NewDefaultDispatcher(space))
ohm := outbound.New()
space.AddApp(new(dispatcher.Config))
space.AddApp(new(proxyman.OutboundConfig))
ohm := proxyman.OutboundHandlerManagerFromSpace(space)
ohm.SetDefaultHandler(
freedom.New(
&freedom.Config{},
@@ -50,7 +52,6 @@ func TestDokodemoTCP(t *testing.T) {
Network: v2net.Network_TCP,
},
}))
space.BindApp(proxyman.APP_ID_OUTBOUND_MANAGER, ohm)
data2Send := "Data to be sent to remote."
@@ -109,8 +110,10 @@ func TestDokodemoUDP(t *testing.T) {
defer udpServer.Close()
space := app.NewSpace()
space.BindApp(dispatcher.APP_ID, dispatchers.NewDefaultDispatcher(space))
ohm := outbound.New()
space.AddApp(new(dispatcher.Config))
space.AddApp(new(proxyman.OutboundConfig))
ohm := proxyman.OutboundHandlerManagerFromSpace(space)
ohm.SetDefaultHandler(
freedom.New(
&freedom.Config{},
@@ -120,7 +123,6 @@ func TestDokodemoUDP(t *testing.T) {
StreamSettings: &internet.StreamConfig{
Network: v2net.Network_TCP,
}}))
space.BindApp(proxyman.APP_ID_OUTBOUND_MANAGER, ohm)
data2Send := "Data to be sent to remote."