github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/transport/internet/system_dns_android.go (about) 1 //go:build android 2 // +build android 3 4 package internet 5 6 import ( 7 "context" 8 "net" 9 ) 10 11 const SystemDNS = "8.8.8.8:53" 12 13 /* 14 DNSResolverFunc 15 16 This is a temporary API and is subject to removal at any time. 17 */ 18 type DNSResolverFunc func() *net.Resolver 19 20 /* 21 NewDNSResolver 22 23 This is a temporary API and is subject to removal at any time. 24 */ 25 var NewDNSResolver DNSResolverFunc = func() *net.Resolver { 26 return &net.Resolver{ 27 PreferGo: true, 28 Dial: func(ctx context.Context, network, _ string) (net.Conn, error) { 29 var dialer net.Dialer 30 return dialer.DialContext(ctx, network, SystemDNS) 31 }, 32 } 33 } 34 35 func init() { 36 net.DefaultResolver = NewDNSResolver() 37 }