host_windows.go 414 B

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