1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-07-25 03:05:20 -04:00

fix broken tests

This commit is contained in:
Darien Raymond 2018-11-08 01:01:53 +01:00
parent 58221ebae1
commit df2d5b5d75
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
5 changed files with 48 additions and 16 deletions

View File

@ -56,9 +56,11 @@ func TestCommanderRemoveHandler(t *testing.T) {
Rule: []*router.RoutingRule{ Rule: []*router.RoutingRule{
{ {
InboundTag: []string{"api"}, InboundTag: []string{"api"},
TargetTag: &router.RoutingRule_Tag{
Tag: "api", Tag: "api",
}, },
}, },
},
}), }),
}, },
Inbound: []*core.InboundHandlerConfig{ Inbound: []*core.InboundHandlerConfig{
@ -173,9 +175,11 @@ func TestCommanderAddRemoveUser(t *testing.T) {
Rule: []*router.RoutingRule{ Rule: []*router.RoutingRule{
{ {
InboundTag: []string{"api"}, InboundTag: []string{"api"},
TargetTag: &router.RoutingRule_Tag{
Tag: "api", Tag: "api",
}, },
}, },
},
}), }),
serial.ToTypedMessage(&policy.Config{ serial.ToTypedMessage(&policy.Config{
Level: map[uint32]*policy.Policy{ Level: map[uint32]*policy.Policy{
@ -381,9 +385,11 @@ func TestCommanderStats(t *testing.T) {
Rule: []*router.RoutingRule{ Rule: []*router.RoutingRule{
{ {
InboundTag: []string{"api"}, InboundTag: []string{"api"},
TargetTag: &router.RoutingRule_Tag{
Tag: "api", Tag: "api",
}, },
}, },
},
}), }),
serial.ToTypedMessage(&policy.Config{ serial.ToTypedMessage(&policy.Config{
Level: map[uint32]*policy.Policy{ Level: map[uint32]*policy.Policy{

View File

@ -46,9 +46,11 @@ func TestResolveIP(t *testing.T) {
Prefix: 8, Prefix: 8,
}, },
}, },
TargetTag: &router.RoutingRule_Tag{
Tag: "direct", Tag: "direct",
}, },
}, },
},
}), }),
}, },
Inbound: []*core.InboundHandlerConfig{ Inbound: []*core.InboundHandlerConfig{

View File

@ -475,7 +475,9 @@ func TestBlackhole(t *testing.T) {
serial.ToTypedMessage(&router.Config{ serial.ToTypedMessage(&router.Config{
Rule: []*router.RoutingRule{ Rule: []*router.RoutingRule{
{ {
TargetTag: &router.RoutingRule_Tag{
Tag: "blocked", Tag: "blocked",
},
PortRange: net.SinglePortRange(dest2.Port), PortRange: net.SinglePortRange(dest2.Port),
}, },
}, },
@ -714,10 +716,14 @@ func TestDomainSniffing(t *testing.T) {
serial.ToTypedMessage(&router.Config{ serial.ToTypedMessage(&router.Config{
Rule: []*router.RoutingRule{ Rule: []*router.RoutingRule{
{ {
TargetTag: &router.RoutingRule_Tag{
Tag: "direct", Tag: "direct",
},
InboundTag: []string{"snif"}, InboundTag: []string{"snif"},
}, { }, {
TargetTag: &router.RoutingRule_Tag{
Tag: "redir", Tag: "redir",
},
InboundTag: []string{"http"}, InboundTag: []string{"http"},
}, },
}, },

View File

@ -57,13 +57,17 @@ func TestReverseProxy(t *testing.T) {
Domain: []*router.Domain{ Domain: []*router.Domain{
{Type: router.Domain_Full, Value: "test.v2ray.com"}, {Type: router.Domain_Full, Value: "test.v2ray.com"},
}, },
TargetTag: &router.RoutingRule_Tag{
Tag: "portal", Tag: "portal",
}, },
},
{ {
InboundTag: []string{"external"}, InboundTag: []string{"external"},
TargetTag: &router.RoutingRule_Tag{
Tag: "portal", Tag: "portal",
}, },
}, },
},
}), }),
}, },
Inbound: []*core.InboundHandlerConfig{ Inbound: []*core.InboundHandlerConfig{
@ -122,13 +126,17 @@ func TestReverseProxy(t *testing.T) {
Domain: []*router.Domain{ Domain: []*router.Domain{
{Type: router.Domain_Full, Value: "test.v2ray.com"}, {Type: router.Domain_Full, Value: "test.v2ray.com"},
}, },
TargetTag: &router.RoutingRule_Tag{
Tag: "reverse", Tag: "reverse",
}, },
},
{ {
InboundTag: []string{"bridge"}, InboundTag: []string{"bridge"},
TargetTag: &router.RoutingRule_Tag{
Tag: "freedom", Tag: "freedom",
}, },
}, },
},
}), }),
}, },
Inbound: []*core.InboundHandlerConfig{ Inbound: []*core.InboundHandlerConfig{
@ -256,13 +264,17 @@ func TestReverseProxyLongRunning(t *testing.T) {
Domain: []*router.Domain{ Domain: []*router.Domain{
{Type: router.Domain_Full, Value: "test.v2ray.com"}, {Type: router.Domain_Full, Value: "test.v2ray.com"},
}, },
TargetTag: &router.RoutingRule_Tag{
Tag: "portal", Tag: "portal",
}, },
},
{ {
InboundTag: []string{"external"}, InboundTag: []string{"external"},
TargetTag: &router.RoutingRule_Tag{
Tag: "portal", Tag: "portal",
}, },
}, },
},
}), }),
}, },
Inbound: []*core.InboundHandlerConfig{ Inbound: []*core.InboundHandlerConfig{
@ -335,13 +347,17 @@ func TestReverseProxyLongRunning(t *testing.T) {
Domain: []*router.Domain{ Domain: []*router.Domain{
{Type: router.Domain_Full, Value: "test.v2ray.com"}, {Type: router.Domain_Full, Value: "test.v2ray.com"},
}, },
TargetTag: &router.RoutingRule_Tag{
Tag: "reverse", Tag: "reverse",
}, },
},
{ {
InboundTag: []string{"bridge"}, InboundTag: []string{"bridge"},
TargetTag: &router.RoutingRule_Tag{
Tag: "freedom", Tag: "freedom",
}, },
}, },
},
}), }),
}, },
Inbound: []*core.InboundHandlerConfig{ Inbound: []*core.InboundHandlerConfig{

View File

@ -231,7 +231,9 @@ func TestSocksBridageUDPWithRouting(t *testing.T) {
serial.ToTypedMessage(&router.Config{ serial.ToTypedMessage(&router.Config{
Rule: []*router.RoutingRule{ Rule: []*router.RoutingRule{
{ {
TargetTag: &router.RoutingRule_Tag{
Tag: "out", Tag: "out",
},
InboundTag: []string{"socks"}, InboundTag: []string{"socks"},
}, },
}, },