utils_linux.go 383 B

1234567891011121314151617181920
  1. //go:build linux
  2. // +build linux
  3. package probing
  4. // Returns the length of an ICMP message.
  5. func (p *Pinger) getMessageLength() int {
  6. return p.Size + 8
  7. }
  8. // Attempts to match the ID of an ICMP packet.
  9. func (p *Pinger) matchID(ID int) bool {
  10. // On Linux we can only match ID if we are privileged.
  11. if p.protocol == "icmp" {
  12. if ID != p.id {
  13. return false
  14. }
  15. }
  16. return true
  17. }