utils_windows.go 457 B

12345678910111213141516171819202122232425
  1. //go:build windows
  2. // +build windows
  3. package probing
  4. import (
  5. "golang.org/x/net/ipv4"
  6. "golang.org/x/net/ipv6"
  7. )
  8. // Returns the length of an ICMP message, plus the IP packet header.
  9. func (p *Pinger) getMessageLength() int {
  10. if p.ipv4 {
  11. return p.Size + 8 + ipv4.HeaderLen
  12. }
  13. return p.Size + 8 + ipv6.HeaderLen
  14. }
  15. // Attempts to match the ID of an ICMP packet.
  16. func (p *Pinger) matchID(ID int) bool {
  17. if ID != p.id {
  18. return false
  19. }
  20. return true
  21. }