Module zebra_network::peer_set::initialize

source ยท
Expand description

A peer set whose size is dynamically determined by resource constraints.

The PeerSet implementation is adapted from the one in tower::Balance.

Modulesยง

  • recent_by_ip ๐Ÿ”’
    A set of IPs from recent connection attempts.

Enumsยง

  • CrawlerAction ๐Ÿ”’
    An action that the peer crawler can take.

Functionsยง

  • Listens for peer connections on addr, then sets up each connection as a Zcash peer.
  • Set up a new inbound connection as a Zcash peer.
  • add_initial_peers ๐Ÿ”’
    Use the provided outbound_connector to connect to the configured DNS seeder and disk cache initial peers, then send the resulting peer connections over peerset_tx.
  • crawl ๐Ÿ”’
    Try to get more peers using candidates, then queue a connection attempt using demand_tx. If there were no new peers and should_always_dial is false, the connection attempt is skipped.
  • crawl_and_dial ๐Ÿ”’
    Given a channel demand_rx that signals a need for new peers, try to find and connect to new peers, and send the resulting peer::Clients through the peerset_tx channel.
  • dial ๐Ÿ”’
    Try to connect to candidate using outbound_connector. Uses outbound_connection_tracker to track the active connection count.
  • Initialize a peer set, using a network config, inbound_service, and latest_chain_tip.
  • Limit the number of initial_peers addresses entries to the configured peerset_initial_target_size.
  • open_listener ๐Ÿ”’
    Open a peer connection listener on config.listen_addr, returning the opened [TcpListener], and the address it is bound to.
  • report_failed ๐Ÿ”’
    Mark addr as a failed peer to address_book_updater.

Type Aliasesยง

  • DiscoveredPeer ๐Ÿ”’
    A successful outbound peer connection attempt or inbound connection handshake.