probe/internal/pcap/pcap_test.go
2018-08-29 13:08:37 +09:00

28 lines
447 B
Go

package pcap
import (
"log"
"testing"
"github.com/google/gopacket/pcap"
)
func TestFindIfaces(t *testing.T) {
devices, err := pcap.FindAllDevs()
if err != nil {
log.Fatal(err)
}
t.Log("Devices found:")
for _, d := range devices {
t.Log("\nName: ", d.Name)
t.Log("Description: ", d.Description)
for _, address := range d.Addresses {
t.Log("- IP address: ", address.IP)
t.Log("- Subnet mask: ", address.Netmask)
}
}
}