Skip to content
Switch branches/tags
Go to file

Latest commit

Before this change, I encountered panics like this one:

  panic: runtime error: invalid memory address or nil pointer dereference
  [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6bf24f]

  goroutine 205 [running]:*multiRequest).handleReply.func1(0xc0003bfe00, 0x0, 0x0, 0x0, 0x0)
  	/home/michael/go/pkg/mod/ +0x8f
  created by*multiRequest).handleReply

With an example program like this one:

  func repro() (string, error) {
	bind6 := "::"
	addr, err := net.ResolveIPAddr("ip", "ff02::2%enp3s0f1")
	if err != nil {
		return "", err
	p, err := ping.New("", bind6)
	if err != nil {
		return "", err
	defer p.Close()
	const timeout = 5 * time.Second
	ctx, canc := context.WithTimeout(context.Background(), timeout)
	defer canc()

	log.Printf("ff02:: code path")
	replies, err := p.PingMulticastContext(ctx, addr)
	if err != nil {
		return "", err
	addrs, err := net.InterfaceAddrs()
	if err != nil {
		return "", err
	localAddr := make(map[string]bool)
	for _, addr := range addrs {
		ipnet, ok := addr.(*net.IPNet)
		if !ok {
		localAddr[ipnet.IP.String()] = true
	for reply := range replies {
		if localAddr[reply.Address.String()] {
		go func() {
			for range replies {
				// drain channel
		return fmt.Sprint(reply.Duration) + " from " + reply.Address.String(), nil
	return "", fmt.Errorf("no responses to %s within %v", addr, timeout)

Git stats


Failed to load latest commit information.
Latest commit message
Commit time


GoDoc Build Status Codecov Go Report Card

A simple ICMP Echo implementation, based on

Some sample programs are provided in cmd/:

  • ping-test is a really simple ping clone
  • multiping provides an interactive TUI to ping multiple hosts
  • ping-monitor pings multiple hosts in parallel, but just prints the summary every so often
  • pingnet allows to ping every host in a CIDR range (e.g. :-))


  • IPv4 and IPv6 support
  • Unicast and multicast support
  • configurable retry amount and timeout duration
  • configurable payload size (and content)
  • round trip time measurement


Simply fork and create a pull-request. We'll try to respond in a timely fashion.

Software using this library

Please create a pull request to get your software listed.


MIT License, Copyright (c) 2018 Digineo GmbH