chinasites_json_test.go 670 B

1234567891011121314151617181920212223242526
  1. // +build json
  2. package rules_test
  3. import (
  4. "testing"
  5. . "v2ray.com/core/app/router/rules"
  6. "v2ray.com/core/testing/assert"
  7. )
  8. func TestChinaSitesJson(t *testing.T) {
  9. assert := assert.On(t)
  10. rule := ParseRule([]byte(`{
  11. "type": "chinasites",
  12. "outboundTag": "y"
  13. }`))
  14. assert.String(rule.Tag).Equals("y")
  15. assert.Bool(rule.Apply(makeDomainDestination("v.qq.com"))).IsTrue()
  16. assert.Bool(rule.Apply(makeDomainDestination("www.163.com"))).IsTrue()
  17. assert.Bool(rule.Apply(makeDomainDestination("ngacn.cc"))).IsTrue()
  18. assert.Bool(rule.Apply(makeDomainDestination("12306.cn"))).IsTrue()
  19. assert.Bool(rule.Apply(makeDomainDestination("v2ray.com"))).IsFalse()
  20. }