func Ping(ip string) (*PingResult, error) {
	pinger := &Pinger{}
	pinger.AddIPs([]string{ip})
	res, err := pinger.Start()
	if err != nil {
		return nil, err
	}
	select {
	case pr := <-res:
		return pr, nil
	case <-time.Tick(100 * time.Millisecond):
		return nil, fmt.Errorf("ping/Ping: timed out waiting for echo reply")
	}
}
Ping sends ICMP ECHO_REQUEST to a single IP address, wait for the ECHO_REPLY,
and returns the result.
package netx
import (
	"bytes"
	"encoding/binary"
	"encoding/gob"
	"errors"
	"fmt"
	"io"
	"net"
	"os"
	"runtime"
	"sync"
	"sync/atomic"
	"syscall"
	"time"
	"github.com/surgebase/glog"
	"golang.org/x/net/icmp"
	"golang.org/x/net/ipv4"
	"golang.org/x/net/ipv6"
)
const (
	icmpHeaderSize   = 8
	defaultInterval  = 100 * time.Millisecond
	defaultMaxRTT    = 100 * time.Millisecond
	defaultTTL       = 32
	defaultSize      = 8
	ProtocolICMP     = 1
	ProtocolIPv6ICMP = 58
)