func (packet Packet) Bytes() []byte {
	data := make([]byte, HeaderSize+len(packet.Payload))

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

	data[12] = byte(packet.EtherType >> 8)
	data[13] = byte(packet.EtherType)

	for i, b := range packet.Payload {
		data[14+i] = b
	}

	return data
}
// Bytes converts an ethernet packet to a byte slice.
Bytes converts an ethernet packet to a byte slice.
// Bytes converts an ethernet packet to a byte slice .
func (packet Packet) Bytes() []byte {
	data := make([]byte, HeaderSize+len(packet.Payload))
	for i := 0; i < MACLength; i++ {
		data[i] = packet.Destination[i]
		data[i+6] = packet.Source[i]
	}
	data[12] = byte(packet.EtherType >> 8)
	data[13] = byte(packet.EtherType)
	for i, b := range packet.Payload {
		data[14+i] = b
	}
	return data
}
func ( packet Packet ) Bytes ( ) [ ] byte { data := make ( [ ] byte , HeaderSize + len ( packet . Payload ) ) for i := 0 ; i < MACLength ; i ++ { data [ i ] = packet . Destination [ i ] data [ i + 6 ] = packet . Source [ i ] } data [ 12 ] = byte ( packet . EtherType >> 8 ) data [ 13 ] = byte ( packet . EtherType ) for i , b := range packet . Payload { data [ 14 + i ] = b } return data }
Bytes converts an ethernet packet to a byte slice.
Bytes converts an ethernet packet to a byte slice .