Lob v1.0.0 Lob View Source

Length-Object-Binary (LOB) Packet Encoding

Data serialization, primarily in use by the Telehash Project

Link to this section Summary

Functions

Cloak a packet to frustrate wire monitoring

De-cloak a cloaked packet

Decode a wire packet for consumption

Encode a head and body into a packet

Link to this section Types

Link to this type maybe_binary() View Source
maybe_binary() :: binary | nil

Link to this section Functions

Link to this function cloak(b) View Source
cloak(binary) :: binary

Cloak a packet to frustrate wire monitoring

A random number (between 1 and 20) of rounds are applied. This also serves to slightly obfuscate the message size.

Link to this function decloak(b) View Source
decloak(binary) :: Lob.DecodedPacket.t | no_return

De-cloak a cloaked packet.

Upon success, the decoded packet will have the number of cloaking rounds unfurled in the cloaked field.

Link to this function decode(arg) View Source
decode(binary) :: Lob.DecodedPacket.t | no_return

Decode a wire packet for consumption

The parts are returned in a struct compliant with the specification. Errors reflecting improperly decoded JSON are stored in the json field.

Link to this function encode(head, body) View Source
encode(maybe_binary | map, maybe_binary) ::
  binary |
  no_return

Encode a head and body into a packet

The packet should be usable across any supported transport. May raise an exception if the payload is too large or there are encoding errors.