Pull request: 5035-netip-arp-hosts
Updates #5035. Squashed commit of the following: commit d1c4493ee4e28d05670c20532ebae1aa809d18da Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Oct 25 14:26:52 2022 +0300 aghnet: imp hosts rec equal commit 0a7f40a64a819245fba20d3b481b0fc34e0c60e6 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Oct 24 18:10:09 2022 +0300 aghnet: move arp and hosts to netip.Addr
This commit is contained in:
@@ -5,6 +5,7 @@ package aghnet
|
||||
import (
|
||||
"bufio"
|
||||
"net"
|
||||
"net/netip"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
@@ -43,13 +44,15 @@ func parseArpA(sc *bufio.Scanner, lenHint int) (ns []Neighbor) {
|
||||
|
||||
n := Neighbor{}
|
||||
|
||||
if ip := net.ParseIP(fields[0]); ip == nil {
|
||||
ip, err := netip.ParseAddr(fields[0])
|
||||
if err != nil {
|
||||
continue
|
||||
} else {
|
||||
n.IP = ip
|
||||
}
|
||||
|
||||
if mac, err := net.ParseMAC(fields[1]); err != nil {
|
||||
mac, err := net.ParseMAC(fields[1])
|
||||
if err != nil {
|
||||
continue
|
||||
} else {
|
||||
n.MAC = mac
|
||||
|
||||
Reference in New Issue
Block a user