github.com/sagernet/sing@v0.4.0-beta.19.0.20240518125136-f67a0988a636/common/windnsapi/dnsapi_windows.go (about) 1 package windnsapi 2 3 import ( 4 "os" 5 "syscall" 6 7 "golang.org/x/sys/windows" 8 ) 9 10 var ( 11 moddnsapi = windows.NewLazySystemDLL("dnsapi.dll") 12 procDnsFlushResolverCache = moddnsapi.NewProc("DnsFlushResolverCache") 13 ) 14 15 func FlushResolverCache() error { 16 r0, _, err := syscall.SyscallN(procDnsFlushResolverCache.Addr()) 17 if r0 == 0 { 18 return os.NewSyscallError("DnsFlushResolverCache", err) 19 } 20 return nil 21 }