Pull request: all: support setgid, setuid on unix

Updates #2763.

Squashed commit of the following:

commit bd2077c6569b53ae341a58aa73de6063d7037e8e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jun 4 16:25:17 2021 +0300

    all: move rlimit_nofile, imp docs

commit ba95d4ab7c722bf83300d626a598aface37539ad
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jun 4 15:12:23 2021 +0300

    all: support setgid, setuid on unix
This commit is contained in:
Ainar Garipov
2021-06-04 16:35:34 +03:00
parent 3b87478470
commit 48c44c29ab
14 changed files with 283 additions and 31 deletions

View File

@@ -13,6 +13,7 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghos"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/insomniacslk/dhcp/dhcpv4"
@@ -41,7 +42,7 @@ func CheckIfOtherDHCPServersPresentV4(ifaceName string) (ok bool, err error) {
// TODO(a.garipov): Find out what this is about. Perhaps this
// information is outdated or at least incomplete.
if runtime.GOOS == "darwin" {
return false, fmt.Errorf("can't find DHCP server: not supported on macOS")
return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4")
}
srcIP := ifaceIPNet[0]

View File

@@ -1,11 +1,15 @@
// +build windows
//go:build windows
package dhcpd
import "fmt"
import "github.com/AdguardTeam/AdGuardHome/internal/aghos"
func CheckIfOtherDHCPServersPresentV4(ifaceName string) (bool, error) {
return false, fmt.Errorf("not supported")
return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4")
}
func CheckIfOtherDHCPServersPresentV6(ifaceName string) (bool, error) {
return false, fmt.Errorf("not supported")
return false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV6")
}

View File

@@ -1,13 +1,17 @@
// +build windows
//go:build windows
package dhcpd
import (
"net"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/AdGuardHome/internal/aghos"
"golang.org/x/net/ipv4"
)
// Create a socket for receiving broadcast packets
func newBroadcastPacketConn(bindAddr net.IP, port int, ifname string) (*ipv4.PacketConn, error) {
return nil, errors.Error("newBroadcastPacketConn(): not supported on Windows")
func newBroadcastPacketConn(_ net.IP, _ int, _ string) (*ipv4.PacketConn, error) {
return nil, aghos.Unsupported("newBroadcastPacketConn")
}