diff --git a/cmd/ping/ping.go b/cmd/ping/ping.go index 0b29eb6..acb5b89 100644 --- a/cmd/ping/ping.go +++ b/cmd/ping/ping.go @@ -94,7 +94,7 @@ func main() { pinger.Interval = *interval pinger.Timeout = *timeout pinger.TTL = *ttl - pinger.InterfaceDevice = *iface + pinger.InterfaceName = *iface pinger.SetPrivileged(*privileged) fmt.Printf("PING %s (%s):\n", pinger.Addr(), pinger.IPAddr()) diff --git a/ping.go b/ping.go index 8a58517..b6de420 100644 --- a/ping.go +++ b/ping.go @@ -208,7 +208,7 @@ type Pinger struct { Source string // Interface used to send/recv ICMP messages - InterfaceDevice string + InterfaceName string // Channel and mutex used to communicate when the Pinger should stop between goroutines. done chan interface{} @@ -528,8 +528,8 @@ func (p *Pinger) RunWithContext(ctx context.Context) error { } conn.SetTTL(p.TTL) - if p.InterfaceDevice != "" { - iface, err := net.InterfaceByName(p.InterfaceDevice) + if p.InterfaceName != "" { + iface, err := net.InterfaceByName(p.InterfaceName) if err != nil { return err } diff --git a/ping_test.go b/ping_test.go index 7b775c8..d26bd82 100644 --- a/ping_test.go +++ b/ping_test.go @@ -480,7 +480,7 @@ func TestSetInterfaceName(t *testing.T) { pinger.Timeout = time.Second // Set loopback interface - pinger.InterfaceDevice = "lo" + pinger.InterfaceName = "lo" err := pinger.Run() if runtime.GOOS == "linux" { AssertNoError(t, err) @@ -489,7 +489,7 @@ func TestSetInterfaceName(t *testing.T) { } // Set fake interface - pinger.InterfaceDevice = "L()0pB@cK" + pinger.InterfaceName = "L()0pB@cK" err = pinger.Run() AssertError(t, err, "device not found") }