1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-26 03:57:42 -05:00
v2fly/infra/conf/dns_bootstrap_test.go

29 lines
558 B
Go

package conf
import (
"context"
"net"
"testing"
)
func TestBootstrapDNS(t *testing.T) {
const (
defaultNS = "8.8.8.8:53"
domain = "github.com"
)
var dialer net.Dialer
net.DefaultResolver = &net.Resolver{
PreferGo: true,
Dial: func(context context.Context, network, address string) (net.Conn, error) {
conn, err := dialer.DialContext(context, "udp", defaultNS)
if err != nil {
return nil, err
}
return conn, nil
},
}
if ips, err := net.LookupIP(domain); len(ips) == 0 {
t.Error("set BootstrapDNS failed: ", err)
}
}