|
|
@@ -40,7 +40,7 @@ func TestSimpleRouter(t *testing.T) {
|
|
|
mockHs := mocks.NewOutboundHandlerSelector(mockCtl)
|
|
|
|
|
|
r := new(Router)
|
|
|
- common.Must(r.Init(config, mockDNS, &mockOutboundManager{
|
|
|
+ common.Must(r.Init(context.TODO(), config, mockDNS, &mockOutboundManager{
|
|
|
Manager: mockOhm,
|
|
|
HandlerSelector: mockHs,
|
|
|
}))
|
|
|
@@ -81,7 +81,7 @@ func TestSimpleBalancer(t *testing.T) {
|
|
|
mockHs.EXPECT().Select(gomock.Eq([]string{"test-"})).Return([]string{"test"})
|
|
|
|
|
|
r := new(Router)
|
|
|
- common.Must(r.Init(config, mockDNS, &mockOutboundManager{
|
|
|
+ common.Must(r.Init(context.TODO(), config, mockDNS, &mockOutboundManager{
|
|
|
Manager: mockOhm,
|
|
|
HandlerSelector: mockHs,
|
|
|
}))
|
|
|
@@ -119,7 +119,7 @@ func TestIPOnDemand(t *testing.T) {
|
|
|
mockDNS.EXPECT().LookupIP(gomock.Eq("v2fly.org")).Return([]net.IP{{192, 168, 0, 1}}, nil).AnyTimes()
|
|
|
|
|
|
r := new(Router)
|
|
|
- common.Must(r.Init(config, mockDNS, nil))
|
|
|
+ common.Must(r.Init(context.TODO(), config, mockDNS, nil))
|
|
|
|
|
|
ctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: net.TCPDestination(net.DomainAddress("v2fly.org"), 80)})
|
|
|
route, err := r.PickRoute(routing_session.AsRoutingContext(ctx))
|
|
|
@@ -154,7 +154,7 @@ func TestIPIfNonMatchDomain(t *testing.T) {
|
|
|
mockDNS.EXPECT().LookupIP(gomock.Eq("v2fly.org")).Return([]net.IP{{192, 168, 0, 1}}, nil).AnyTimes()
|
|
|
|
|
|
r := new(Router)
|
|
|
- common.Must(r.Init(config, mockDNS, nil))
|
|
|
+ common.Must(r.Init(context.TODO(), config, mockDNS, nil))
|
|
|
|
|
|
ctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: net.TCPDestination(net.DomainAddress("v2fly.org"), 80)})
|
|
|
route, err := r.PickRoute(routing_session.AsRoutingContext(ctx))
|
|
|
@@ -188,7 +188,7 @@ func TestIPIfNonMatchIP(t *testing.T) {
|
|
|
mockDNS := mocks.NewDNSClient(mockCtl)
|
|
|
|
|
|
r := new(Router)
|
|
|
- common.Must(r.Init(config, mockDNS, nil))
|
|
|
+ common.Must(r.Init(context.TODO(), config, mockDNS, nil))
|
|
|
|
|
|
ctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: net.TCPDestination(net.LocalHostIP, 80)})
|
|
|
route, err := r.PickRoute(routing_session.AsRoutingContext(ctx))
|