Files
Xray-core/app/dns/nameserver_local_test.go
T

27 lines
536 B
Go
Raw Normal View History

2020-11-25 19:01:53 +08:00
package dns_test
import (
"context"
"testing"
"time"
2020-12-04 09:36:16 +08:00
. "github.com/xtls/xray-core/app/dns"
"github.com/xtls/xray-core/common"
2021-10-16 21:02:51 +08:00
"github.com/xtls/xray-core/features/dns"
2020-11-25 19:01:53 +08:00
)
func TestLocalNameServer(t *testing.T) {
s := NewLocalNameServer()
2020-11-25 19:01:53 +08:00
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
ips, _, err := s.QueryIP(ctx, "google.com", dns.IPOption{
2020-11-25 19:01:53 +08:00
IPv4Enable: true,
IPv6Enable: true,
2021-03-06 23:39:50 -05:00
FakeEnable: false,
})
2020-11-25 19:01:53 +08:00
cancel()
common.Must(err)
if len(ips) == 0 {
t.Error("expect some ips, but got 0")
}
}