Skip to main content

Module node

Module node 

Source
Expand description

The libp2p node: TCP and QUIC (or an in-memory transport for tests) with Noise and Yamux; mDNS on the local network; Kademlia, identify and ping; relay client and (opt-in) relay server with DCUtR hole punching; AutoNAT; and request-response on the profile’s protocol id, carrying the application’s own request and response types (CBOR).

The swarm runs on its own thread with a small Tokio runtime. Node is a blocking handle (the CLI and TUI are synchronous): requests wait for their answer. Requests that come in are answered by a Handler on Tokio’s blocking pool.

Structs§

Node
A running node.
NodeConfig
How a node runs.
RelayLimits
Limits of the relay server: how many reservations and circuits it holds, and how long and how much one circuit may carry. RelayLimits::default keeps libp2p’s defaults (circuits for hole punching and small requests: 2 minutes, 128 KiB); RelayLimits::unlimited caps nothing, so circuits carry data.
Sighting
A peer seen by the node, for the handler to remember.
Status
What the node is doing.

Traits§

Handler
Answers requests from peers. The peer id is the one Noise authenticated.
Message
What a node carries: the application’s request and response types (sent as CBOR).