func (p *packetConn) WriteTo(b []byte, addr net.Addr) (int, error) {
	// Ensure correct Addr type.
	a, ok := addr.(*Addr)
	if !ok || a.HardwareAddr == nil {
		return 0, unix.EINVAL
	}

	// Convert hardware address back to byte array form.
	var baddr [8]byte
	copy(baddr[:], a.HardwareAddr)

	// Send message on socket to the specified hardware address from addr
	// packet(7):
	//   When you send packets it is enough to specify sll_family, sll_addr,
	//   sll_halen, sll_ifindex, and sll_protocol. The other fields should
	//   be 0.
	// In this case, sll_family is taken care of automatically by unix.
	err := p.s.Sendto(b, 0, &unix.SockaddrLinklayer{
		Ifindex:  p.ifi.Index,
		Halen:    uint8(len(a.HardwareAddr)),
		Addr:     baddr,
		Protocol: p.pbe,
	})
	return len(b), err
}
// WriteTo implements the net.PacketConn.WriteTo method.
WriteTo implements the net.PacketConn.WriteTo method.
// WriteTo implements the net . PacketConn . WriteTo method .
func (p *packetConn) WriteTo(b []byte, addr net.Addr) (int, error) {
	a, ok := addr.(*Addr)
	if !ok || a.HardwareAddr == nil {
		return 0, unix.EINVAL
	}
	var baddr [8]byte
	copy(baddr[:], a.HardwareAddr)
	err := p.s.Sendto(b, 0, &unix.SockaddrLinklayer{
		Ifindex:  p.ifi.Index,
		Halen:    uint8(len(a.HardwareAddr)),
		Addr:     baddr,
		Protocol: p.pbe,
	})
	return len(b), err
}
func ( p * packetConn ) WriteTo ( b [ ] byte , addr net . Addr ) ( int , error ) { a , ok := addr . ( * Addr ) if ! ok || a . HardwareAddr == nil { return 0 , unix . EINVAL } var baddr [ 8 ] byte copy ( baddr [ : ] , a . HardwareAddr ) err := p . s . Sendto ( b , 0 , & unix . SockaddrLinklayer { Ifindex : p . ifi . Index , Halen : uint8 ( len ( a . HardwareAddr ) ) , Addr : baddr , Protocol : p . pbe , } ) return len ( b ) , err }
WriteTo implements the net.PacketConn.WriteTo method.
WriteTo implements the net . PacketConn . WriteTo method .
// Ensure correct Addr type. // Convert hardware address back to byte array form. // Send message on socket to the specified hardware address from addr // packet(7): //   When you send packets it is enough to specify sll_family, sll_addr, //   sll_halen, sll_ifindex, and sll_protocol. The other fields should //   be 0. // In this case, sll_family is taken care of automatically by unix.