Skip to content
Dr. Maxim Orlovsky edited this page Jul 5, 2022 · 1 revision

There are two types of connections provided by this library: (1) on top of TCP sockets and (2) using ZMQ sockets.

TCP socket connection is used exclusively to establish P2P sessions, in lightning-style. ZMQ is not used in these sessions, and these sessions always use encryption and messsage size limits. Before, it was just a 64kb limit (Brontide protocol as described in BOLT-8), now with v0.8 I have added Brontozaur encryption having 16 MB size limit. These two sessions can be created with BrontideSession and BrontozaurSession types respectively, used by PeerConnection type in upstream rust-microservices. To establish this type of connection NodeAddr is used from inet2_addr, providing full information about both peer TCP socket and node key used in establishing encrypted session.

ZMQ socket sessions are used only for RPC interface and inter-service ESB messaging - and not for P2P protocols. By default, they are unencrypted - and this type of ZMQ session is named LocalSession and the address used to establish this session named ServiceAddr. It MUST NOT restrict size of the messages - and if it does, it is a bug. The name LocalSession implies that it is safe to use this type of connection only if two services are running on the same machine - i.e. as a part of the same process (inproc ZMQ socket), as different processes (IPC socket) or via local TCP interface. If the services communicate across non-loopback network, the communication must be encrypted with Brontozaur protocol (with 16MB message size limit) - and this connection will be named RpcSession. For obvious reasons it will support only tcp:// ZMQ sockets and again use NodeAddr (since we need both IP address, TCP port and node key).

Clone this wiki locally