nameserver_test.go 390 B

123456789101112131415161718192021
  1. package dns_test
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. . "v2ray.com/core/app/dns"
  7. "v2ray.com/core/common"
  8. )
  9. func TestLocalNameServer(t *testing.T) {
  10. s := NewLocalNameServer()
  11. ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
  12. ips, err := s.QueryIP(ctx, "google.com")
  13. cancel()
  14. common.Must(err)
  15. if len(ips) == 0 {
  16. t.Error("expect some ips, but got 0")
  17. }
  18. }