func (c *PacketConn) WriteTo(b []byte, dst net.Addr) (int, error) {
	if !c.ok() {
		return 0, errInvalidConn
	}
	return c.c.WriteTo(b, dst)
}
WriteTo writes the ICMP message b to dst.
The provided dst must be net.UDPAddr when c is a non-privileged
datagram-oriented ICMP endpoint.
Otherwise it must be net.IPAddr.
package icmp
import (
	"net"
	"runtime"
	"time"
	"golang.org/x/net/ipv4"
	"golang.org/x/net/ipv6"
)
var _ net.PacketConn = &PacketConn{}
type PacketConn struct {
	c  net.PacketConn
	p4 *ipv4.PacketConn
	p6 *ipv6.PacketConn
}
func (c *PacketConn) ok() bool { return c != nil && c.c != nil }
func (c *PacketConn) IPv4PacketConn() *ipv4.PacketConn {
	if !c.ok() {
		return nil
	}
	return c.p4
}
func (c *PacketConn) IPv6PacketConn() *ipv6.PacketConn {
	if !c.ok() {
		return nil
	}
	return c.p6
}
func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error) {
	if !c.ok() {
		return 0, nil, errInvalidConn
	}
	if runtime.GOOS == "darwin" && c.p4 != nil {
		n, _, peer, err := c.p4.ReadFrom(b)
		return n, peer, err
	}
	return c.c.ReadFrom(b)
}