AdGuardHome/internal/aghnet/interfaces_linux.go

24 lines
597 B
Go
Raw Normal View History

//go:build linux
package aghnet
import (
"net"
"github.com/AdguardTeam/golibs/netutil"
"github.com/insomniacslk/dhcp/dhcpv4/nclient4"
)
// listenPacketReusable announces on the local network address additionally
// configuring the socket to have a reusable binding.
func listenPacketReusable(ifaceName, network, address string) (c net.PacketConn, err error) {
2023-10-11 17:31:41 +03:00
var port uint16
_, port, err = netutil.SplitHostPort(address)
if err != nil {
return nil, err
}
// TODO(e.burkov): Inspect nclient4.NewRawUDPConn and implement here.
2023-10-11 17:31:41 +03:00
return nclient4.NewRawUDPConn(ifaceName, int(port))
}