func (p *packetConn) ReadFrom(b []byte) (int, net.Addr, error) {
	// Attempt to receive on socket
	n, addr, err := p.s.Recvfrom(b, 0)
	if err != nil {
		return n, nil, err
	}

	// Retrieve hardware address and other information from addr.
	sa, ok := addr.(*unix.SockaddrLinklayer)
	if !ok {
		return n, nil, unix.EINVAL
	}

	// Use length specified to convert byte array into a hardware address slice.
	mac := make(net.HardwareAddr, sa.Halen)
	copy(mac, sa.Addr[:])

	// packet(7):
	//   sll_hatype and sll_pkttype are set on received packets for your
	//   information.
	// TODO(mdlayher): determine if similar fields exist and are useful on
	// non-Linux platforms
	return n, &Addr{
		HardwareAddr: mac,
	}, nil
}
// ReadFrom implements the net.PacketConn.ReadFrom method.
ReadFrom implements the net.PacketConn.ReadFrom method.
// ReadFrom implements the net . PacketConn . ReadFrom method .
func (p *packetConn) ReadFrom(b []byte) (int, net.Addr, error) {
	n, addr, err := p.s.Recvfrom(b, 0)
	if err != nil {
		return n, nil, err
	}
	sa, ok := addr.(*unix.SockaddrLinklayer)
	if !ok {
		return n, nil, unix.EINVAL
	}
	mac := make(net.HardwareAddr, sa.Halen)
	copy(mac, sa.Addr[:])
	return n, &Addr{
		HardwareAddr: mac,
	}, nil
}
func ( p * packetConn ) ReadFrom ( b [ ] byte ) ( int , net . Addr , error ) { n , addr , err := p . s . Recvfrom ( b , 0 ) if err != nil { return n , nil , err } sa , ok := addr . ( * unix . SockaddrLinklayer ) if ! ok { return n , nil , unix . EINVAL } mac := make ( net . HardwareAddr , sa . Halen ) copy ( mac , sa . Addr [ : ] ) return n , & Addr { HardwareAddr : mac , } , nil }
ReadFrom implements the net.PacketConn.ReadFrom method.
ReadFrom implements the net . PacketConn . ReadFrom method .
// Attempt to receive on socket // Retrieve hardware address and other information from addr. // Use length specified to convert byte array into a hardware address slice. // packet(7): //   sll_hatype and sll_pkttype are set on received packets for your //   information. // TODO(mdlayher): determine if similar fields exist and are useful on // non-Linux platforms