Pull request: all: mv some utilities to netutil
Merge in DNS/adguard-home from mv-netutil to master Squashed commit of the following: commit 5698fceed656dca7f8644e7dbd7e1a7fc57a68ce Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Aug 9 15:44:17 2021 +0300 dnsforward: add todos commit 122fb6e3de658b296931e0f608cf24ef85547666 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Aug 9 14:27:46 2021 +0300 all: mv some utilities to netutil
This commit is contained in:
@@ -7,8 +7,8 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
|
||||
"github.com/AdguardTeam/golibs/log"
|
||||
"github.com/AdguardTeam/golibs/netutil"
|
||||
"golang.org/x/net/icmp"
|
||||
"golang.org/x/net/ipv6"
|
||||
)
|
||||
@@ -42,7 +42,7 @@ type icmpv6RA struct {
|
||||
//
|
||||
// See https://tools.ietf.org/html/rfc4861#section-4.6.1.
|
||||
func hwAddrToLinkLayerAddr(hwa net.HardwareAddr) (lla []byte, err error) {
|
||||
err = aghnet.ValidateHardwareAddress(hwa)
|
||||
err = netutil.ValidateMAC(hwa)
|
||||
if err != nil {
|
||||
// Don't wrap the error, because it already contains enough
|
||||
// context.
|
||||
@@ -56,8 +56,8 @@ func hwAddrToLinkLayerAddr(hwa net.HardwareAddr) (lla []byte, err error) {
|
||||
return lla, nil
|
||||
}
|
||||
|
||||
// Assume that aghnet.ValidateHardwareAddress prevents lengths other
|
||||
// than 20 by now.
|
||||
// Assume that netutil.ValidateMAC prevents lengths other than 20 by
|
||||
// now.
|
||||
lla = make([]byte, 24)
|
||||
copy(lla, hwa)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user