2021-08-21 05:20:40 +00:00
|
|
|
//go:build android
|
2021-05-04 21:22:01 +00:00
|
|
|
// +build android
|
|
|
|
|
|
|
|
package internet
|
|
|
|
|
|
|
|
import (
|
2021-05-04 21:40:07 +00:00
|
|
|
"context"
|
2021-05-04 21:22:01 +00:00
|
|
|
"net"
|
|
|
|
)
|
|
|
|
|
|
|
|
const SystemDNS = "8.8.8.8:53"
|
|
|
|
|
2022-06-28 12:26:01 +00:00
|
|
|
/*
|
|
|
|
DNSResolverFunc
|
|
|
|
|
|
|
|
This is a temporary API and is subject to removal at any time.
|
2021-05-04 21:25:37 +00:00
|
|
|
*/
|
2021-05-04 21:22:01 +00:00
|
|
|
type DNSResolverFunc func() *net.Resolver
|
|
|
|
|
2022-06-28 12:26:01 +00:00
|
|
|
/*
|
|
|
|
NewDNSResolver
|
|
|
|
|
|
|
|
This is a temporary API and is subject to removal at any time.
|
2021-05-04 21:25:37 +00:00
|
|
|
*/
|
2021-05-04 21:22:01 +00: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()
|
|
|
|
}
|