mirror of
https://github.com/xmdhs/natupnp.git
synced 2025-09-27 11:22:23 +08:00
android dns
This commit is contained in:
24
dns.go
Normal file
24
dns.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//go:build androidgodns
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
|
const bootstrapDNS = "223.5.5.5:53"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
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
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user