mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-19 14:21:58 +03:00
2a1ad532f4
Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package aghnet
|
|
|
|
import (
|
|
"io"
|
|
"syscall"
|
|
"time"
|
|
|
|
"github.com/AdguardTeam/AdGuardHome/internal/aghos"
|
|
"github.com/AdguardTeam/golibs/errors"
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func canBindPrivilegedPorts() (can bool, err error) {
|
|
return true, nil
|
|
}
|
|
|
|
func ifaceHasStaticIP(string) (ok bool, err error) {
|
|
return false, aghos.Unsupported("checking static ip")
|
|
}
|
|
|
|
func ifaceSetStaticIP(string) (err error) {
|
|
return aghos.Unsupported("setting static ip")
|
|
}
|
|
|
|
// closePortChecker closes c. c must be non-nil.
|
|
func closePortChecker(c io.Closer) (err error) {
|
|
if err = c.Close(); err != nil {
|
|
return err
|
|
}
|
|
|
|
// It seems that net.Listener.Close() doesn't close file descriptors right
|
|
// away. We wait for some time and hope that this fd will be closed.
|
|
//
|
|
// TODO(e.burkov): Investigate the purpose of the line and perhaps use more
|
|
// reliable approach.
|
|
time.Sleep(100 * time.Millisecond)
|
|
|
|
return nil
|
|
}
|
|
|
|
func isAddrInUse(err syscall.Errno) (ok bool) {
|
|
return errors.Is(err, windows.WSAEADDRINUSE)
|
|
}
|