mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-04 20:37:40 +03:00
21 lines
415 B
Go
21 lines
415 B
Go
package windnsapi
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
var (
|
|
moddnsapi = windows.NewLazySystemDLL("dnsapi.dll")
|
|
procDnsFlushResolverCache = moddnsapi.NewProc("DnsFlushResolverCache")
|
|
)
|
|
|
|
func FlushResolverCache() error {
|
|
r0, _, err := syscall.SyscallN(procDnsFlushResolverCache.Addr())
|
|
if r0 == 0 {
|
|
return os.NewSyscallError("DnsFlushResolverCache", err)
|
|
}
|
|
return nil
|
|
}
|