cloudprober: Index | Files | Directories

package ping

import ""

Package ping implements a fast ping prober. It sends ICMP pings to a list of targets and reports statistics on packets sent, received and latency experienced.

This ping implementation supports two types of sockets: Raw and datagram ICMP sockets.

Raw sockets require root privileges and all the ICMP noise is copied on all raw sockets opened for ICMP. We have to deal with the unwanted ICMP noise.

On the other hand, datagram ICMP sockets are unprivileged and implemented in such a way that kernel copies only relevant packets on them. Kernel assigns a local port for such sockets and rewrites ICMP id of the outgoing packets to match that port number. Incoming ICMP packets' ICMP id is matched with the local port to find the correct destination socket.

More about these sockets: Note: On some linux distributions these sockets are not enabled by default; you can enable them by doing something like the following:

sudo sysctl -w net.ipv4.ping_group_range="0 5000"


Package Files

icmpconn_unix.go ping.go pingutils.go


var NativeEndian binary.ByteOrder

NativeEndian is the machine native endian implementation of ByteOrder.

type Probe Uses

type Probe struct {
    // contains filtered or unexported fields

Probe implements a ping probe type that sends ICMP ping packets to the targets and reports back statistics on packets sent, received and the rtt.

func (*Probe) Init Uses

func (p *Probe) Init(name string, opts *options.Options) error

Init initliazes the probe with the given params.

func (*Probe) Start Uses

func (p *Probe) Start(ctx context.Context, dataChan chan *metrics.EventMetrics)

Start starts the probe and writes back the data on the provided channel. Probe should have been initialized with Init() before calling Start on it.


cmdThis program implements a stand-alone ping prober binary using the cloudprober/ping package.

Package ping imports 25 packages (graph) and is imported by 8 packages. Updated 2021-01-26. Refresh now. Tools for package owners.