pub struct Network<TTrans, TInEvent, TOutEvent, THandler> where
    TTrans: Transport,
    THandler: IntoConnectionHandler
{ /* private fields */ }
Expand description

Implementation of Stream that handles the nodes.

Implementations

Creates a new node events stream.

Returns the transport passed when building this object.

Start listening on the given multiaddress.

Remove a previously added listener.

Returns Ok(()) if a listener with this ID was in the list.

Returns an iterator that produces the list of addresses we are listening on.

Maps the given observed_addr, representing an address of the local node observed by a remote peer, onto the locally known listen addresses to yield one or more addresses of the local node that may be publicly reachable.

I.e. this method incorporates the view of other peers into the listen addresses seen by the local node to account for possible IP and port mappings performed by intermediate network devices in an effort to obtain addresses for the local peer that are also reachable for peers other than the peer who reported the observed_addr.

The translation is transport-specific. See Transport::address_translation.

Returns the peer id of the local node.

Dials a multiaddress without expecting a particular remote peer ID.

The given handler will be used to create the Connection upon success and the connection ID is returned.

Returns information about the state of the Network.

Returns an iterator for information on all pending incoming connections.

Returns the list of addresses we’re currently dialing without knowing the PeerId of.

Returns a list of all connected peers, i.e. peers to whom the Network has at least one established connection.

Checks whether the network has an established connection to a peer.

Checks whether the network has an ongoing dialing attempt to a peer.

Checks whether the network has neither an ongoing dialing attempt, nor an established connection to a peer.

Returns a list of all the peers to whom a new outgoing connection is currently being established.

Obtains a view of a Peer with the given ID in the network.

Accepts a pending incoming connection obtained via NetworkEvent::IncomingConnection, adding it to the Networks connection pool subject to the configured limits.

Once the connection is established and all transport protocol upgrades completed, the connection is associated with the provided handler.

Provides an API similar to Stream, except that it cannot error.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.