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