()
| 9 | ) |
| 10 | |
| 11 | func Get() (Table, error) { |
| 12 | data, err := exec.Command("netsh", "interface", "ipv6", "show", "neighbors").Output() |
| 13 | if err != nil { |
| 14 | return nil, err |
| 15 | } |
| 16 | |
| 17 | var t Table |
| 18 | for _, line := range strings.Split(string(data), "\n") { |
| 19 | fields := strings.Fields(line) |
| 20 | if len(fields) < 3 { |
| 21 | continue |
| 22 | } |
| 23 | |
| 24 | if mac := parseMAC(strings.ReplaceAll(fields[1], "-", ":")); mac != nil { |
| 25 | t = append(t, Entry{ |
| 26 | IP: net.ParseIP(fields[0]), |
| 27 | MAC: mac, |
| 28 | }) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | return t, nil |
| 33 | } |