Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Implementing ping(8) in Go

Implementing ping(8) in Go

Presentation for Go Northwest 2018 https://gonorthwest.io/

Source code is available at https://github.com/erriapo/goping

Avatar for Gavin Chun Jin

Gavin Chun Jin

July 30, 2018

Other Decks in Programming

Transcript

  1. Features of Simple clone of ping(8) with minimal features. goping

    • IPv4 only. • Option to control the number of ECHO_REQUEST E.g. ping -c 4 www.google.ca • No support for -s packetsize ICMP payload is a constant.
  2. Rendering output 2 goping https://github.com/erriapo/stats To maintain a running variance

    of RTTs as they come in, we use B. P. Welford’s method (1962). Formula is taken with permission from John D Cook’s blogpost.
  3. Raw sockets Only processes with an effective user ID of

    0 or the CAP_NET_RAW attribute may do that. ~ man 7 raw You can run goping SETUID root or give the binary the minimum linux capability to use raw sockets.
  4. goping In a multi nic situation, you can direct goping

    to send the ICMP probes via a specific interface. supports multiple interfaces 1