1
0
Fork 0
mirror of https://github.com/pnx/pinger.git synced 2026-06-16 03:24:54 +02:00

main.go: make printStats() take a probing.Statistics object.

This commit is contained in:
Henrik Hautakoski 2025-05-31 17:24:25 +02:00
parent 2747946264
commit 57a969561e

View file

@ -12,9 +12,7 @@ import (
)
// printStats prints statistics from a ping.
func printStats(pinger *probing.Pinger) {
stats := pinger.Statistics()
func printStats(stats *probing.Statistics) {
fmt.Printf("%d packets transmitted, %d packets received, %.2f%% packet loss\n",
stats.PacketsSent, stats.PacketsRecv, stats.PacketLoss)
@ -38,7 +36,7 @@ func eventLoop(pinger *probing.Pinger, ticker *time.Ticker) {
return
// Ticker ticks. print stats.
case <-ticker.C:
printStats(pinger)
printStats(pinger.Statistics())
}
}
}