1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00
v2fly/transport/internet/system_dns_android.go

38 lines
654 B
Go
Raw Normal View History

//go:build android
// +build android
package internet
import (
2021-05-04 17:40:07 -04:00
"context"
"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.
*/
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.
*/
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()
}