checker: Use OnFinish to perform need tips about firewall
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2023-03-18 11:22:46 +01:00
commit d61f28875e
2 changed files with 23 additions and 10 deletions

View file

@ -98,7 +98,7 @@ func has_test(m map[AdlinTest]int, test AdlinTest) bool {
// ICMP
func check_ping(ip string, cb func(pkt *ping.Packet)) (err error) {
func check_ping(ip string, cb func(pkt *ping.Packet), cb_finished func(stats *ping.Statistics)) (err error) {
var pinger *ping.Pinger
pinger, err = ping.NewPinger(ip)
if err != nil {
@ -112,6 +112,7 @@ func check_ping(ip string, cb func(pkt *ping.Packet)) (err error) {
pinger.Timeout = time.Second * 5
pinger.Count = 1
pinger.OnRecv = cb
pinger.OnFinish = cb_finished
pinger.SetPrivileged(true)
err = pinger.Run()