Skip to content

Commit

Permalink
fix: Support for ping in windows machine
Browse files Browse the repository at this point in the history
  • Loading branch information
muskankhedia committed Oct 4, 2021
1 parent eec00b1 commit 9a55da5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/modules/evaluate/machine.go
Expand Up @@ -2,6 +2,7 @@ package evaluate

import (
"fmt"
"runtime"
"time"

"github.com/go-ping/ping"
Expand All @@ -22,6 +23,9 @@ type Jitter struct {
// Machine evaluates calculations related to ping and jitter.
func Machine(host string) (*Ping, *Jitter, error) {
pinger, err := ping.NewPinger(host)
if runtime.GOOS == "windows" {
pinger.SetPrivileged(true)
}
if err != nil {
return nil, nil, fmt.Errorf("error creating pinger : %w", err)
}
Expand Down

0 comments on commit 9a55da5

Please sign in to comment.