diff --git a/README.md b/README.md index d77a261..730c105 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ please see "cmd/ping/ping.go". This package implements ICMP ping using both raw socket and UDP. If your program uses this package in raw socket mode, it needs to be run as a root user. +If you are using the UDP socket on Linux, you may also need to allow UDP pings (even root is not allowed by default on debian for example): +``` +sudo sysctl -w net.ipv4.ping_group_range="0 2147483647" +``` + ## License go-fastping is under MIT License. See the [LICENSE][license] file for details. diff --git a/fastping_test.go b/fastping_test.go index c708b82..b608a79 100644 --- a/fastping_test.go +++ b/fastping_test.go @@ -165,7 +165,7 @@ func TestRun(t *testing.T) { t.Fatalf("AddIP failed: %v", err) } - if err := p.AddIP("127.0.0.100"); err != nil { + if err := p.AddIP("198.51.100.100"); err != nil { t.Fatalf("AddIP failed: %v", err) } @@ -179,7 +179,7 @@ func TestRun(t *testing.T) { called = true if ip.String() == "127.0.0.1" { found1 = true - } else if ip.String() == "127.0.0.100" { + } else if ip.String() == "198.51.100.100" { found100 = true } else if ip.String() == "::1" { foundv6 = true @@ -204,7 +204,7 @@ func TestRun(t *testing.T) { t.Fatalf("Pinger `127.0.0.1` didn't respond") } if found100 { - t.Fatalf("Pinger `127.0.0.100` responded") + t.Fatalf("Pinger `198.51.100.100` responded") } if !foundv6 { t.Fatalf("Pinger `::1` didn't responded")