Skip to content

Commit

Permalink
feat: add env to run from local
Browse files Browse the repository at this point in the history
Set `WITHOUT_PING_PRIVILIGED` to true if running from mac
  • Loading branch information
nick-bisonai committed Aug 24, 2024
1 parent 6f0794f commit 7d46038
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion node/pkg/checker/ping/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package ping

import (
"context"
"os"
"strconv"
"time"

probing "github.com/prometheus-community/pro-bing"
Expand Down Expand Up @@ -96,7 +98,10 @@ func New(opts ...AppOption) (*App, error) {
return nil, err
}

pinger.SetPrivileged(true)
withoutPriviliged, err := strconv.ParseBool(os.Getenv("WITHOUT_PING_PRIVILIGED"))
if !withoutPriviliged || err != nil {
pinger.SetPrivileged(true)
}

pinger.OnRecv = func(pkt *probing.Packet) {
app.ResultsBuffer <- PingResult{
Expand Down

0 comments on commit 7d46038

Please sign in to comment.