summaryrefslogtreecommitdiff
path: root/ping.go
diff options
context:
space:
mode:
Diffstat (limited to 'ping.go')
-rw-r--r--ping.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/ping.go b/ping.go
index a41b4ab..ba825e8 100644
--- a/ping.go
+++ b/ping.go
@@ -7,6 +7,9 @@ import (
"strings"
)
+// Ping sends one ICMP echo packet to the given IP and times how long
+// it takes to get a response, in milleseconds. Returns -1 if no
+// response is received.
func Ping(ip net.IP) float64 {
cmd := exec.Command("ping",
"-n", // numeric