mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-04-16 18:49:16 -04:00
update test for router refactor
This commit is contained in:
@@ -112,7 +112,7 @@ func TestDNSConfigParsing(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
StaticHosts: []*dns.Config_HostMapping{
|
||||
StaticHosts: []*dns.HostMapping{
|
||||
{
|
||||
Type: dns.DomainMatchingType_Subdomain,
|
||||
Domain: "example.com",
|
||||
|
||||
@@ -2,6 +2,7 @@ package router_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/v2fly/v2ray-core/v4/app/router/routercommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
router2 "github.com/v2fly/v2ray-core/v4/infra/conf/synthetic/router"
|
||||
"testing"
|
||||
@@ -108,7 +109,7 @@ func TestRouterConfig(t *testing.T) {
|
||||
}`,
|
||||
Parser: createParser(),
|
||||
Output: &router.Config{
|
||||
DomainStrategy: router.Config_AsIs,
|
||||
DomainStrategy: router.DomainStrategy_AsIs,
|
||||
BalancingRule: []*router.BalancingRule{
|
||||
{
|
||||
Tag: "b1",
|
||||
@@ -140,13 +141,13 @@ func TestRouterConfig(t *testing.T) {
|
||||
},
|
||||
Rule: []*router.RoutingRule{
|
||||
{
|
||||
Domain: []*router.Domain{
|
||||
Domain: []*routercommon.Domain{
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "baidu.com",
|
||||
},
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "qq.com",
|
||||
},
|
||||
},
|
||||
@@ -155,13 +156,13 @@ func TestRouterConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Domain: []*router.Domain{
|
||||
Domain: []*routercommon.Domain{
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "v2fly.org",
|
||||
},
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "github.com",
|
||||
},
|
||||
},
|
||||
@@ -170,9 +171,9 @@ func TestRouterConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Geoip: []*router.GeoIP{
|
||||
Geoip: []*routercommon.GeoIP{
|
||||
{
|
||||
Cidr: []*router.CIDR{
|
||||
Cidr: []*routercommon.CIDR{
|
||||
{
|
||||
Ip: []byte{10, 0, 0, 0},
|
||||
Prefix: 8,
|
||||
@@ -248,16 +249,16 @@ func TestRouterConfig(t *testing.T) {
|
||||
}`,
|
||||
Parser: createParser(),
|
||||
Output: &router.Config{
|
||||
DomainStrategy: router.Config_IpIfNonMatch,
|
||||
DomainStrategy: router.DomainStrategy_IpIfNonMatch,
|
||||
Rule: []*router.RoutingRule{
|
||||
{
|
||||
Domain: []*router.Domain{
|
||||
Domain: []*routercommon.Domain{
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "baidu.com",
|
||||
},
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "qq.com",
|
||||
},
|
||||
},
|
||||
@@ -266,13 +267,13 @@ func TestRouterConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Domain: []*router.Domain{
|
||||
Domain: []*routercommon.Domain{
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "v2fly.org",
|
||||
},
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "github.com",
|
||||
},
|
||||
},
|
||||
@@ -281,9 +282,9 @@ func TestRouterConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Geoip: []*router.GeoIP{
|
||||
Geoip: []*routercommon.GeoIP{
|
||||
{
|
||||
Cidr: []*router.CIDR{
|
||||
Cidr: []*routercommon.CIDR{
|
||||
{
|
||||
Ip: []byte{10, 0, 0, 0},
|
||||
Prefix: 8,
|
||||
@@ -334,16 +335,16 @@ func TestRouterConfig(t *testing.T) {
|
||||
}`,
|
||||
Parser: createParser(),
|
||||
Output: &router.Config{
|
||||
DomainStrategy: router.Config_AsIs,
|
||||
DomainStrategy: router.DomainStrategy_AsIs,
|
||||
Rule: []*router.RoutingRule{
|
||||
{
|
||||
Domain: []*router.Domain{
|
||||
Domain: []*routercommon.Domain{
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "baidu.com",
|
||||
},
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "qq.com",
|
||||
},
|
||||
},
|
||||
@@ -352,13 +353,13 @@ func TestRouterConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Domain: []*router.Domain{
|
||||
Domain: []*routercommon.Domain{
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "v2fly.org",
|
||||
},
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Type: routercommon.Domain_Plain,
|
||||
Value: "github.com",
|
||||
},
|
||||
},
|
||||
@@ -367,9 +368,9 @@ func TestRouterConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
Geoip: []*router.GeoIP{
|
||||
Geoip: []*routercommon.GeoIP{
|
||||
{
|
||||
Cidr: []*router.CIDR{
|
||||
Cidr: []*routercommon.CIDR{
|
||||
{
|
||||
Ip: []byte{10, 0, 0, 0},
|
||||
Prefix: 8,
|
||||
|
||||
@@ -2,6 +2,7 @@ package v4_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/v2fly/v2ray-core/v4/app/router/routercommon"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/muxcfg"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/cfgcommon/testassist"
|
||||
"github.com/v2fly/v2ray-core/v4/infra/conf/v4"
|
||||
@@ -158,12 +159,12 @@ func TestV2RayConfig(t *testing.T) {
|
||||
serial.ToTypedMessage(&proxyman.InboundConfig{}),
|
||||
serial.ToTypedMessage(&proxyman.OutboundConfig{}),
|
||||
serial.ToTypedMessage(&router.Config{
|
||||
DomainStrategy: router.Config_AsIs,
|
||||
DomainStrategy: router.DomainStrategy_AsIs,
|
||||
Rule: []*router.RoutingRule{
|
||||
{
|
||||
Geoip: []*router.GeoIP{
|
||||
Geoip: []*routercommon.GeoIP{
|
||||
{
|
||||
Cidr: []*router.CIDR{
|
||||
Cidr: []*routercommon.CIDR{
|
||||
{
|
||||
Ip: []byte{10, 0, 0, 0},
|
||||
Prefix: 8,
|
||||
|
||||
Reference in New Issue
Block a user