Feat: healthcheck uses ping instead of DNS

This commit is contained in:
Quentin McGaw (desktop)
2021-09-11 21:49:46 +00:00
parent 0eccd068e5
commit 541a4a3271
8 changed files with 215 additions and 27 deletions

View File

@@ -0,0 +1,19 @@
package healthcheck
import "github.com/go-ping/ping"
//go:generate mockgen -destination=pinger_mock_test.go -package healthcheck . Pinger
type Pinger interface {
Run() error
Stop()
}
func newPinger() (pinger *ping.Pinger) {
const addrToPing = "1.1.1.1"
const count = 1
pinger = ping.New(addrToPing)
pinger.Count = count
pinger.SetPrivileged(true)
return pinger
}