The public entry point: a thin facade that wires the layers together. More...
#include "transport/connection.h"#include "transport/reactor_pool.h"#include "core/address.h"#include "peer/peer_table.h"#include "peer/peer_id.h"#include "peer/peer_info.h"#include "security/identity.h"#include "security/handshaker.h"#include "node/config.h"#include "node/node_context.h"#include "peer/peer.h"#include "node/peer_network.h"#include "wire/message_router.h"#include <atomic>#include <condition_variable>#include <functional>#include <memory>#include <mutex>#include <optional>#include <string>#include <string_view>#include <thread>#include <type_traits>#include <vector>Go to the source code of this file.
Classes | |
| class | librats::Node |
Namespaces | |
| namespace | librats |
The public entry point: a thin facade that wires the layers together.
Node owns the reactor pool, the security provider, the peer directory and the message router, and it IS the ConnectionDelegate the reactors report to. It is deliberately thin — it composes the layers and exposes a small async API; the logic lives in those layers, not here.
Threading: connect/send/broadcast are non-blocking and thread-safe — they post work to the owning reactor. Event callbacks (on_peer_connected / on(channel,…) / on_peer_disconnected) run on a reactor thread; register them before start().
── What a bare Node does, and what it does NOT ────────────────────────────── A Node on its own is just the secure transport core. Out of the box it gives you:
Everything else is an opt-in Subsystem you attach with add_subsystem() BEFORE start(): peer discovery (DhtDiscovery, MdnsDiscovery), pub/sub (PubSub), typed JSON messaging (MessageJson), file transfer (FileTransfer), liveness (PingService), NAT port mapping (PortMappingService), automatic reconnection (ReconnectionService), distributed storage (StorageManager). None of these are wired by default — a bare Node neither discovers peers nor reconnects on its own; the application composes exactly the capabilities it wants. This is deliberate: the node stays a small, predictable core, and you pay only for what you attach.
Definition in file node.h.