2021-08-21 01:20:40 -04:00
|
|
|
//go:build android
|
2021-05-04 17:22:01 -04:00
|
|
|
// +build android
|
|
|
|
|
|
|
|
package internet
|
|
|
|
|
|
|
|
import (
|
2021-05-04 17:40:07 -04:00
|
|
|
"context"
|
2021-05-04 17:22:01 -04:00
|
|
|
"net"
|
|
|
|
)
|
|
|
|
|
|
|
|
const SystemDNS = "8.8.8.8:53"
|
|
|
|
|
2022-06-28 08:26:01 -04:00
|
|
|
/*
|
|
|
|
DNSResolverFunc
|
|
|
|
|
|
|
|
This is a temporary API and is subject to removal at any time.
|
2021-05-04 17:25:37 -04:00
|
|
|
*/
|
2021-05-04 17:22:01 -04:00
|
|
|
type DNSResolverFunc func() *net.Resolver
|
|
|
|
|
2022-06-28 08:26:01 -04:00
|
|
|
/*
|
|
|
|
NewDNSResolver
|
|
|
|
|
|
|
|
This is a temporary API and is subject to removal at any time.
|
2021-05-04 17:25:37 -04:00
|
|
|
*/
|
2021-05-04 17:22:01 -04:00
|
|
|
var NewDNSResolver DNSResolverFunc = func() *net.Resolver {
|
|
|
|
return &net.Resolver{
|
|
|
|
PreferGo: true,
|
|
|
|
Dial: func(ctx context.Context, network, _ string) (net.Conn, error) {
|
|
|
|
var dialer net.Dialer
|
|
|
|
return dialer.DialContext(ctx, network, SystemDNS)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
net.DefaultResolver = NewDNSResolver()
|
|
|
|
}
|