mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
26 lines
428 B
Go
26 lines
428 B
Go
|
// +build android
|
||
|
|
||
|
package conf
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"net"
|
||
|
)
|
||
|
|
||
|
const bootstrapDNS = "8.8.8.8:53"
|
||
|
|
||
|
func BootstrapDNS() bool {
|
||
|
var dialer net.Dialer
|
||
|
net.DefaultResolver = &net.Resolver{
|
||
|
PreferGo: false,
|
||
|
Dial: func(context context.Context, _, _ string) (net.Conn, error) {
|
||
|
conn, err := dialer.DialContext(context, "udp", bootstrapDNS)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return conn, nil
|
||
|
},
|
||
|
}
|
||
|
return true
|
||
|
}
|