github.com/kelleygo/clashcore@v1.0.2/component/resolver/host_windows.go (about)

     1  //go:build !go1.22
     2  
     3  // a simple standard lib fix from: https://github.com/golang/go/commit/33d4a5105cf2b2d549922e909e9239a48b8cefcc
     4  
     5  package resolver
     6  
     7  import (
     8  	"golang.org/x/sys/windows"
     9  	_ "unsafe"
    10  )
    11  
    12  //go:linkname testHookHostsPath net.testHookHostsPath
    13  var testHookHostsPath string
    14  
    15  func init() {
    16  	if dir, err := windows.GetSystemDirectory(); err == nil {
    17  		testHookHostsPath = dir + "/Drivers/etc/hosts"
    18  	}
    19  }