Skip to main content

start_network_with

Function start_network_with 

Source
pub fn start_network_with(
    identity: &Identity,
    event_tx: Sender<NetworkEvent>,
    mode: NetworkMode,
    listen_port: u16,
    relays: Vec<Multiaddr>,
) -> Result<NetworkHandle>
Expand description

Start the network task with explicit mode, TCP listen port, and any pre-configured relay multiaddrs. listen_port = 0 requests a random port. Relays are dialed on startup; once Identify lands from a relay peer, we call listen_on("<relay>/p2p-circuit") to register a reservation so peers behind NAT can dial us through it.