mirror of
https://github.com/go-ping/ping.git
synced 2025-04-27 10:31:15 +00:00
This installation method was deprecated because the associated tool has been deprecated. Download "by hand" and run checks before trying to use binary. Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
21 lines
380 B
Go
21 lines
380 B
Go
//go:build linux
|
|
// +build linux
|
|
|
|
package ping
|
|
|
|
// Returns the length of an ICMP message.
|
|
func (p *Pinger) getMessageLength() int {
|
|
return p.Size + 8
|
|
}
|
|
|
|
// Attempts to match the ID of an ICMP packet.
|
|
func (p *Pinger) matchID(ID int) bool {
|
|
// On Linux we can only match ID if we are privileged.
|
|
if p.protocol == "icmp" {
|
|
if ID != p.id {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|