mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-08-11 01:57:15 +00:00
28 lines
586 B
Go
28 lines
586 B
Go
![]() |
// +build json
|
||
|
|
||
|
package rules_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
. "github.com/v2ray/v2ray-core/app/router/rules"
|
||
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
||
|
v2testing "github.com/v2ray/v2ray-core/testing"
|
||
|
"github.com/v2ray/v2ray-core/testing/assert"
|
||
|
)
|
||
|
|
||
|
func TestFieldRule(t *testing.T) {
|
||
|
v2testing.Current(t)
|
||
|
|
||
|
rule := ParseRule([]byte(`{
|
||
|
"type": "field",
|
||
|
"domain": [
|
||
|
"ooxx.com",
|
||
|
"oxox.com"
|
||
|
],
|
||
|
"outboundTag": "direct"
|
||
|
}`))
|
||
|
assert.Pointer(rule).IsNotNil()
|
||
|
assert.Bool(rule.Apply(v2net.TCPDestination(v2net.DomainAddress("www.ooxx.com"), 80))).IsTrue()
|
||
|
}
|