github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/app/dns/nameserver_test.go (about) 1 package dns_test 2 3 import ( 4 "context" 5 "testing" 6 "time" 7 8 . "v2ray.com/core/app/dns" 9 "v2ray.com/core/common" 10 ) 11 12 func TestLocalNameServer(t *testing.T) { 13 s := NewLocalNameServer() 14 ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) 15 ips, err := s.QueryIP(ctx, "google.com", IPOption{ 16 IPv4Enable: true, 17 IPv6Enable: true, 18 }) 19 cancel() 20 common.Must(err) 21 if len(ips) == 0 { 22 t.Error("expect some ips, but got 0") 23 } 24 }