Skip to main content

Module util

Module util 

Source

Constants§

FORMAT_COMPRESSED
Set in the format byte when the node bytes after it are zlib-compressed. Only inbound payloads ever set it.
FORMAT_PLAIN
A plaintext frame is a format byte followed by the node bytes the decoder reads. The byte is a flag set with a single defined bit, FORMAT_COMPRESSED; FORMAT_PLAIN is the uncompressed form and the only one we emit.

Functions§

check_plain_payload
Check that data is a packed payload in the form we produce: a FORMAT_PLAIN byte followed by at least one node byte.
pack
Prefix node bytes with the format byte: the inverse of unpack, turning a buffer the decoder consumed back into one a send path accepts.
unpack
Strip the format byte from a packed payload, decompressing the node bytes when it says they are.
unpack_bytes
Unpack a network payload into an owned Bytes buffer.