@reus 试了下,可以做到,不过这种方法在 windows 下无效

https://godoc.org/net

On Windows, the resolver always uses C library functions, such as GetAddrInfo and DnsQuery.

```
dns = 1.1.1.1
net.DefaultResolver = &net.Resolver{
PreferGo: true,
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
d := net.Dialer{
Timeout: time.Millisecond * time.Duration(4000),
}
return d.DialContext(ctx, "udp", fmt.Sprintf("%s:53", dns))
},
}