Module darkfi::net

source ·



  • Handles the acceptance of inbound socket connections. Used to start listening on a local socket, to accept incoming connections, and to handle network errors.
  • Async channel that handles the sending of messages across the network. Public interface is used to create new channels, to stop and start a channel, and to send messages.
  • Handles the creation of outbound connections. Used to establish an outbound connection.
  • Optional events based debug-notify subsystem. Off by default. Enabled in P2P instance, and then call p2p.dnet_sub() to start receiving events.
  • Hosts are a list of network addresses used when establishing outbound connections. Hosts are shared across the network through the address protocol. When attempting to connect, a node will loop through addresses in the hosts store until it finds ones to connect to.
  • Defines how to decode generic messages as well as implementing the common network messages that are sent between nodes as described by the protocol submodule.
  • Generic publish/subscribe class that can dispatch any kind of message to a subscribed list of dispatchers. Dispatchers subscribe to a single message format of any type. This is a generalized version of the simple publish-subscribe class in system::Subscriber.
  • P2P provides all core functionality to interact with the P2P network.
  • Defines the networking protocol used at each stage in a connection. Consists of a series of messages that are sent across the network at the different connection stages.
  • Defines the interaction between nodes during a connection. Consists of an inbound session, which describes how to set up an incoming connection, and an outbound session, which describes setting up an outbound connection. Also describes the sesd session, which is the type of connection used when a node connects to the network for the first time. Implements the Session trait which describes the common functions across all sessions.
  • Network configuration settings. This holds the configured P2P instance behaviour and is controlled by clients of this API.
  • Network transports, holds implementations of pluggable transports. Exposes agnostic dialers and agnostic listeners.