mirror of https://github.com/XTLS/Xray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
590 B
28 lines
590 B
4 years ago
|
package dns_test
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
3 years ago
|
"github.com/xtls/xray-core/common/net"
|
||
4 years ago
|
"testing"
|
||
|
"time"
|
||
|
|
||
4 years ago
|
. "github.com/xtls/xray-core/app/dns"
|
||
|
"github.com/xtls/xray-core/common"
|
||
3 years ago
|
"github.com/xtls/xray-core/features/dns"
|
||
4 years ago
|
)
|
||
|
|
||
|
func TestLocalNameServer(t *testing.T) {
|
||
|
s := NewLocalNameServer()
|
||
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
|
||
3 years ago
|
ips, err := s.QueryIP(ctx, "google.com", net.IP{}, dns.IPOption{
|
||
4 years ago
|
IPv4Enable: true,
|
||
|
IPv6Enable: true,
|
||
4 years ago
|
FakeEnable: false,
|
||
3 years ago
|
}, false)
|
||
4 years ago
|
cancel()
|
||
|
common.Must(err)
|
||
|
if len(ips) == 0 {
|
||
|
t.Error("expect some ips, but got 0")
|
||
|
}
|
||
|
}
|