2022-03-15 17:57:46 +00:00
|
|
|
//go:build darwin || freebsd
|
|
|
|
|
2023-08-24 11:42:17 +01:00
|
|
|
package arpdb
|
2022-03-15 17:57:46 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
2022-10-25 13:08:12 +01:00
|
|
|
"net/netip"
|
2022-03-15 17:57:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const arpAOutput = `
|
2022-03-23 17:47:45 +00:00
|
|
|
invalid.mac (1.2.3.4) at 12:34:56:78:910 on el0 ifscope [ethernet]
|
|
|
|
invalid.ip (1.2.3.4.5) at ab:cd:ef:ab:cd:12 on ek0 ifscope [ethernet]
|
|
|
|
invalid.fmt 1 at 12:cd:ef:ab:cd:ef on er0 ifscope [ethernet]
|
2022-03-15 17:57:46 +00:00
|
|
|
hostname.one (192.168.1.2) at ab:cd:ef:ab:cd:ef on en0 ifscope [ethernet]
|
|
|
|
hostname.two (::ffff:ffff) at ef:cd:ab:ef:cd:ab on em0 expires in 1198 seconds [ethernet]
|
2022-03-23 17:47:45 +00:00
|
|
|
? (::1234) at aa:bb:cc:dd:ee:ff on ej0 expires in 1918 seconds [ethernet]
|
2022-03-15 17:57:46 +00:00
|
|
|
`
|
|
|
|
|
|
|
|
var wantNeighs = []Neighbor{{
|
|
|
|
Name: "hostname.one",
|
2022-10-25 13:08:12 +01:00
|
|
|
IP: netip.MustParseAddr("192.168.1.2"),
|
2022-03-15 17:57:46 +00:00
|
|
|
MAC: net.HardwareAddr{0xAB, 0xCD, 0xEF, 0xAB, 0xCD, 0xEF},
|
|
|
|
}, {
|
|
|
|
Name: "hostname.two",
|
2022-10-25 13:08:12 +01:00
|
|
|
IP: netip.MustParseAddr("::ffff:ffff"),
|
2022-03-15 17:57:46 +00:00
|
|
|
MAC: net.HardwareAddr{0xEF, 0xCD, 0xAB, 0xEF, 0xCD, 0xAB},
|
2022-03-23 17:47:45 +00:00
|
|
|
}, {
|
|
|
|
Name: "",
|
2022-10-25 13:08:12 +01:00
|
|
|
IP: netip.MustParseAddr("::1234"),
|
2022-03-23 17:47:45 +00:00
|
|
|
MAC: net.HardwareAddr{0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF},
|
2022-03-15 17:57:46 +00:00
|
|
|
}}
|