|
@@ -18,7 +18,8 @@ func TestDomainRule(t *testing.T) {
|
|
|
"type": "field",
|
|
"type": "field",
|
|
|
"domain": [
|
|
"domain": [
|
|
|
"ooxx.com",
|
|
"ooxx.com",
|
|
|
- "oxox.com"
|
|
|
|
|
|
|
+ "oxox.com",
|
|
|
|
|
+ "regexp:\\.cn$"
|
|
|
],
|
|
],
|
|
|
"network": "tcp",
|
|
"network": "tcp",
|
|
|
"outboundTag": "direct"
|
|
"outboundTag": "direct"
|
|
@@ -27,7 +28,8 @@ func TestDomainRule(t *testing.T) {
|
|
|
assert.Bool(rule.Apply(v2net.TCPDestination(v2net.DomainAddress("www.ooxx.com"), 80))).IsTrue()
|
|
assert.Bool(rule.Apply(v2net.TCPDestination(v2net.DomainAddress("www.ooxx.com"), 80))).IsTrue()
|
|
|
assert.Bool(rule.Apply(v2net.TCPDestination(v2net.DomainAddress("www.aabb.com"), 80))).IsFalse()
|
|
assert.Bool(rule.Apply(v2net.TCPDestination(v2net.DomainAddress("www.aabb.com"), 80))).IsFalse()
|
|
|
assert.Bool(rule.Apply(v2net.TCPDestination(v2net.IPAddress([]byte{127, 0, 0, 1}), 80))).IsFalse()
|
|
assert.Bool(rule.Apply(v2net.TCPDestination(v2net.IPAddress([]byte{127, 0, 0, 1}), 80))).IsFalse()
|
|
|
-
|
|
|
|
|
|
|
+ assert.Bool(rule.Apply(v2net.TCPDestination(v2net.DomainAddress("www.12306.cn"), 80))).IsTrue()
|
|
|
|
|
+ assert.Bool(rule.Apply(v2net.TCPDestination(v2net.DomainAddress("www.acn.com"), 80))).IsFalse()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func TestIPRule(t *testing.T) {
|
|
func TestIPRule(t *testing.T) {
|