1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-02 07:25:19 -05:00

context'ize apps

This commit is contained in:
Darien Raymond
2017-01-13 13:41:40 +01:00
parent 148e4832eb
commit 17504d2aac
15 changed files with 171 additions and 152 deletions

View File

@@ -40,13 +40,11 @@ func TestDokodemoTCP(t *testing.T) {
defer tcpServer.Close()
space := app.NewSpace()
space.AddApp(new(dispatcher.Config))
space.AddApp(new(proxyman.OutboundConfig))
ctx := app.ContextWithSpace(context.Background(), space)
app.AddApplicationToSpace(ctx, new(dispatcher.Config))
app.AddApplicationToSpace(ctx, new(proxyman.OutboundConfig))
ohm := proxyman.OutboundHandlerManagerFromSpace(space)
ctx := context.Background()
ctx = app.ContextWithSpace(ctx, space)
freedom, err := freedom.New(proxy.ContextWithOutboundMeta(ctx, &proxy.OutboundHandlerMeta{
Address: v2net.LocalHostIP,
StreamSettings: &internet.StreamConfig{
@@ -117,13 +115,11 @@ func TestDokodemoUDP(t *testing.T) {
defer udpServer.Close()
space := app.NewSpace()
space.AddApp(new(dispatcher.Config))
space.AddApp(new(proxyman.OutboundConfig))
ctx := app.ContextWithSpace(context.Background(), space)
app.AddApplicationToSpace(ctx, new(dispatcher.Config))
app.AddApplicationToSpace(ctx, new(proxyman.OutboundConfig))
ohm := proxyman.OutboundHandlerManagerFromSpace(space)
ctx := context.Background()
ctx = app.ContextWithSpace(ctx, space)
freedom, err := freedom.New(proxy.ContextWithOutboundMeta(ctx, &proxy.OutboundHandlerMeta{
Address: v2net.AnyIP,
StreamSettings: &internet.StreamConfig{