mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-21 23:43:27 +01:00
fix: Use privileged mode for ICMP only on Windows
This commit is contained in:
parent
519500508a
commit
aecca63e05
@ -238,12 +238,8 @@ func Ping(address string, config *Config) (bool, time.Duration) {
|
|||||||
pinger := ping.New(address)
|
pinger := ping.New(address)
|
||||||
pinger.Count = 1
|
pinger.Count = 1
|
||||||
pinger.Timeout = config.Timeout
|
pinger.Timeout = config.Timeout
|
||||||
// Set the pinger's privileged mode to true for every GOOS except darwin
|
// See https://github.com/TwiN/gatus/issues/132 and https://github.com/TwiN/gatus/issues/697
|
||||||
// See https://github.com/TwiN/gatus/issues/132
|
pinger.SetPrivileged(runtime.GOOS == "windows")
|
||||||
//
|
|
||||||
// Note that for this to work on Linux, Gatus must run with sudo privileges.
|
|
||||||
// See https://github.com/prometheus-community/pro-bing#linux
|
|
||||||
pinger.SetPrivileged(runtime.GOOS != "darwin")
|
|
||||||
pinger.SetNetwork(config.Network)
|
pinger.SetNetwork(config.Network)
|
||||||
err := pinger.Run()
|
err := pinger.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user