mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-03 20:07:38 +03:00
Add windnsapi
This commit is contained in:
parent
7209937cc2
commit
9a83e35b71
3 changed files with 24 additions and 3 deletions
21
common/windnsapi/dnsapi_windows.go
Normal file
21
common/windnsapi/dnsapi_windows.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
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
|
||||
}
|
2
go.mod
2
go.mod
|
@ -2,4 +2,4 @@ module github.com/sagernet/sing
|
|||
|
||||
go 1.18
|
||||
|
||||
require golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8
|
||||
require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,2 +1,2 @@
|
|||
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
|
||||
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=
|
||||
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue