mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 01:08:33 +00:00
Config: Remove legacy config fields again (#3782)
* Remove more lecacy fields * Patch missing bracket * Fix tests * Fix missing comma * Fix buried test bomb * Cleanup test after removed legacy test content
This commit is contained in:
parent
c90affe7db
commit
6b1bf312d7
4 changed files with 55 additions and 152 deletions
|
@ -64,36 +64,33 @@ func TestRouterConfig(t *testing.T) {
|
|||
runMultiTestCase(t, []TestCase{
|
||||
{
|
||||
Input: `{
|
||||
"strategy": "rules",
|
||||
"settings": {
|
||||
"domainStrategy": "AsIs",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"baidu.com",
|
||||
"qq.com"
|
||||
],
|
||||
"outboundTag": "direct"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": [
|
||||
"10.0.0.0/8",
|
||||
"::1/128"
|
||||
],
|
||||
"outboundTag": "test"
|
||||
},{
|
||||
"type": "field",
|
||||
"port": "53, 443, 1000-2000",
|
||||
"outboundTag": "test"
|
||||
},{
|
||||
"type": "field",
|
||||
"port": 123,
|
||||
"outboundTag": "test"
|
||||
}
|
||||
]
|
||||
},
|
||||
"domainStrategy": "AsIs",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"baidu.com",
|
||||
"qq.com"
|
||||
],
|
||||
"outboundTag": "direct"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": [
|
||||
"10.0.0.0/8",
|
||||
"::1/128"
|
||||
],
|
||||
"outboundTag": "test"
|
||||
},{
|
||||
"type": "field",
|
||||
"port": "53, 443, 1000-2000",
|
||||
"outboundTag": "test"
|
||||
},{
|
||||
"type": "field",
|
||||
"port": 123,
|
||||
"outboundTag": "test"
|
||||
}
|
||||
],
|
||||
"balancers": [
|
||||
{
|
||||
"tag": "b1",
|
||||
|
@ -225,28 +222,25 @@ func TestRouterConfig(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Input: `{
|
||||
"strategy": "rules",
|
||||
"settings": {
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"baidu.com",
|
||||
"qq.com"
|
||||
],
|
||||
"outboundTag": "direct"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": [
|
||||
"10.0.0.0/8",
|
||||
"::1/128"
|
||||
],
|
||||
"outboundTag": "test"
|
||||
}
|
||||
]
|
||||
}
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"baidu.com",
|
||||
"qq.com"
|
||||
],
|
||||
"outboundTag": "direct"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": [
|
||||
"10.0.0.0/8",
|
||||
"::1/128"
|
||||
],
|
||||
"outboundTag": "test"
|
||||
}
|
||||
]
|
||||
}`,
|
||||
Parser: createParser(),
|
||||
Output: &router.Config{
|
||||
|
@ -289,68 +283,5 @@ func TestRouterConfig(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Input: `{
|
||||
"domainStrategy": "AsIs",
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"domain": [
|
||||
"baidu.com",
|
||||
"qq.com"
|
||||
],
|
||||
"outboundTag": "direct"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": [
|
||||
"10.0.0.0/8",
|
||||
"::1/128"
|
||||
],
|
||||
"outboundTag": "test"
|
||||
}
|
||||
]
|
||||
}`,
|
||||
Parser: createParser(),
|
||||
Output: &router.Config{
|
||||
DomainStrategy: router.Config_AsIs,
|
||||
Rule: []*router.RoutingRule{
|
||||
{
|
||||
Domain: []*router.Domain{
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Value: "baidu.com",
|
||||
},
|
||||
{
|
||||
Type: router.Domain_Plain,
|
||||
Value: "qq.com",
|
||||
},
|
||||
},
|
||||
TargetTag: &router.RoutingRule_Tag{
|
||||
Tag: "direct",
|
||||
},
|
||||
},
|
||||
{
|
||||
Geoip: []*router.GeoIP{
|
||||
{
|
||||
Cidr: []*router.CIDR{
|
||||
{
|
||||
Ip: []byte{10, 0, 0, 0},
|
||||
Prefix: 8,
|
||||
},
|
||||
{
|
||||
Ip: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
|
||||
Prefix: 128,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
TargetTag: &router.RoutingRule_Tag{
|
||||
Tag: "test",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue