chore: update readme
This commit is contained in:
10
icmp.go
10
icmp.go
@@ -31,22 +31,22 @@ type ICMPMonitor struct {
|
||||
// CheckICMPAlive func
|
||||
func CheckICMPAlive(ip string, timeout int) (bool, error) {
|
||||
|
||||
pg, err := yap.NewPinger();
|
||||
pg, err := yap.NewPinger()
|
||||
if err != nil {
|
||||
defer pg.Close()
|
||||
}
|
||||
|
||||
response := pg.Call(yap.Request{
|
||||
Target: ip,
|
||||
Count: 1,
|
||||
Target: ip,
|
||||
Count: 1,
|
||||
Timeout: timeout * 1000})
|
||||
|
||||
if response.Error != nil {
|
||||
return false, response.Error
|
||||
} else {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return true, nil
|
||||
|
||||
}
|
||||
|
||||
// test if it available
|
||||
|
||||
Reference in New Issue
Block a user