func PacketFromBytes(data []byte) (Packet, error) {
	var packet Packet

	if len(data) < HeaderSize {
		return packet, errors.New("packet size too small")
	}

	for i := 0; i < MACLength; i++ {
		packet.Destination[i] = data[i]
		packet.Source[i] = data[i+6]
	}

	packet.EtherType = EtherType(data[12])<<8 | EtherType(data[13])
	packet.Payload = data[14:]

	return packet, nil
}
// PacketFromBytes constructs an ethernet packet from a byte slice.
PacketFromBytes constructs an ethernet packet from a byte slice.
// PacketFromBytes constructs an ethernet packet from a byte slice .
func PacketFromBytes(data []byte) (Packet, error) {
	var packet Packet
	if len(data) < HeaderSize {
		return packet, errors.New("packet size too small")
	}
	for i := 0; i < MACLength; i++ {
		packet.Destination[i] = data[i]
		packet.Source[i] = data[i+6]
	}
	packet.EtherType = EtherType(data[12])<<8 | EtherType(data[13])
	packet.Payload = data[14:]
	return packet, nil
}
func PacketFromBytes ( data [ ] byte ) ( Packet , error ) { var packet Packet if len ( data ) < HeaderSize { return packet , errors . New ( " " ) } for i := 0 ; i < MACLength ; i ++ { packet . Destination [ i ] = data [ i ] packet . Source [ i ] = data [ i + 6 ] } packet . EtherType = EtherType ( data [ 12 ] ) << 8 | EtherType ( data [ 13 ] ) packet . Payload = data [ 14 : ] return packet , nil }
PacketFromBytes constructs an ethernet packet from a byte slice.
PacketFromBytes constructs an ethernet packet from a byte slice .