mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
32 lines
706 B
Go
32 lines
706 B
Go
//go:build !linux
|
|
|
|
package clientinfo
|
|
|
|
import (
|
|
"bytes"
|
|
"os/exec"
|
|
"runtime"
|
|
|
|
"github.com/Control-D-Inc/ctrld"
|
|
)
|
|
|
|
// scan populates NDP table using information from system mappings.
|
|
func (nd *ndpDiscover) scan() {
|
|
switch runtime.GOOS {
|
|
case "windows":
|
|
data, err := exec.Command("netsh", "interface", "ipv6", "show", "neighbors").Output()
|
|
if err != nil {
|
|
ctrld.ProxyLogger.Load().Warn().Err(err).Msg("could not query ndp table")
|
|
return
|
|
}
|
|
nd.scanWindows(bytes.NewReader(data))
|
|
default:
|
|
data, err := exec.Command("ndp", "-an").Output()
|
|
if err != nil {
|
|
ctrld.ProxyLogger.Load().Warn().Err(err).Msg("could not query ndp table")
|
|
return
|
|
}
|
|
nd.scanUnix(bytes.NewReader(data))
|
|
}
|
|
}
|