1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-30 14:05:26 -05:00

strmatcher

This commit is contained in:
Darien Raymond
2018-06-26 21:57:41 +02:00
parent ed34adf967
commit cb0eb91f2b
5 changed files with 214 additions and 111 deletions

View File

@@ -20,46 +20,6 @@ import (
"v2ray.com/ext/sysio"
)
func TestSubDomainMatcher(t *testing.T) {
assert := With(t)
cases := []struct {
pattern string
input string
output bool
}{
{
pattern: "v2ray.com",
input: "www.v2ray.com",
output: true,
},
{
pattern: "v2ray.com",
input: "v2ray.com",
output: true,
},
{
pattern: "v2ray.com",
input: "www.v3ray.com",
output: false,
},
{
pattern: "v2ray.com",
input: "2ray.com",
output: false,
},
{
pattern: "v2ray.com",
input: "xv2ray.com",
output: false,
},
}
for _, test := range cases {
matcher := NewSubDomainMatcher(test.pattern)
assert(matcher.Apply(test.input) == test.output, IsTrue)
}
}
func TestRoutingRule(t *testing.T) {
assert := With(t)