go get github.com/liu-wh/goutils/network
func main() {
host := "www.baidu.com"
num := 10
report, err := network.Ping(host, num)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Lost=%d(%d%% loss)\nMinimum = %v, Maximum = %v, Average = %v", report.LostNum, report.LostPer, report.MinLatency, report.MaxLatency, report.AvgLatency)
}
go get github.com/liu-wh/goutils/convert