MCPcopy Create free account
hub / github.com/evilsocket/cake / encode_packet

Function encode_packet

cake-core/src/cake/sharding/discovery.rs:393–398  ·  view source on GitHub ↗
(payload: &[u8])

Source from the content-addressed store, hash-verified

391}
392
393pub fn encode_packet(payload: &[u8]) -> Vec<u8> {
394 let mut pkt = Vec::with_capacity(4 + payload.len());
395 pkt.extend_from_slice(MAGIC);
396 pkt.extend_from_slice(payload);
397 pkt
398}
399
400pub fn decode_packet(data: &[u8]) -> Option<&[u8]> {
401 if data.len() > 4 && data[..4] == *MAGIC {

Calls

no outgoing calls