Fix #132: ICMP doesn't work on Mac OS

This commit is contained in:
TwinProduction 2021-07-18 20:43:44 -04:00
parent acb6757dc8
commit 43150ae484

View File

@ -7,6 +7,7 @@ import (
"net"
"net/http"
"net/smtp"
"runtime"
"strings"
"time"
@ -107,7 +108,9 @@ func Ping(address string) (bool, time.Duration) {
}
pinger.Count = 1
pinger.Timeout = pingTimeout
pinger.SetPrivileged(true)
// Set the pinger's privileged mode to true for every operating system except darwin
// https://github.com/TwinProduction/gatus/issues/132
pinger.SetPrivileged(runtime.GOOS != "darwin")
err = pinger.Run()
if err != nil {
return false, 0