dns_test.go 477 B

1234567891011121314151617181920212223
  1. package dns_test
  2. import (
  3. "net"
  4. "testing"
  5. "github.com/v2ray/v2ray-core/app/dns"
  6. netassert "github.com/v2ray/v2ray-core/common/net/testing/assert"
  7. v2testing "github.com/v2ray/v2ray-core/testing"
  8. )
  9. func TestDnsAdd(t *testing.T) {
  10. v2testing.Current(t)
  11. domain := "v2ray.com"
  12. cache := dns.NewCache()
  13. ip := cache.Get(domain)
  14. netassert.IP(ip).IsNil()
  15. cache.Add(domain, []byte{1, 2, 3, 4})
  16. ip = cache.Get(domain)
  17. netassert.IP(ip).Equals(net.IP([]byte{1, 2, 3, 4}))
  18. }