github.com/pojntfx/hydrapp/hydrapp@v0.0.0-20240516002902-d08759d6ca9f/pkg/fixes/dns.go (about)

     1  //go:build androiddnsfix && android
     2  // +build androiddnsfix,android
     3  
     4  package fixes
     5  
     6  import (
     7  	_ "unsafe"
     8  )
     9  
    10  //go:linkname defaultNS net.defaultNS
    11  var defaultNS []string
    12  
    13  func SetDefaultNS(ns []string) {
    14  	defaultNS = ns
    15  }
    16  
    17  // See https://gist.github.com/cs8425/107e01a0652f1f1f6e033b5b68364b5e
    18  func init() {
    19  	// Use public DNS servers; useful on i.e. old Android versions which don't have `/etc/resolv.conf`, where DNS lookups would be broken
    20  	SetDefaultNS([]string{"8.8.8.8:53", "8.8.4.4:53", "[2001:4860:4860::8888]:53", "[2001:4860:4860::8844]:53", "1.1.1.1:53", "1.0.0.1:53", "[2606:4700:4700::1111]:53", "[2606:4700:4700::1001]:53"})
    21  }