pub async fn bootstrap(
        &self,
    ) -> Result<(
        Endpoint,
        IncomingConnections,
        IncomingMessages,
        DisconnectionEvents,
        SocketAddr,
    )> {
        let (endpoint, incoming_connections, incoming_message, disconnections) =
            self.new_endpoint().await?;

        let bootstrapped_peer = self
            .bootstrap_with(&endpoint, endpoint.bootstrap_nodes())
            .await?;

        Ok((
            endpoint,
            incoming_connections,
            incoming_message,
            disconnections,
            bootstrapped_peer,
        ))
    }
/// Bootstrap to the network.
///
/// Bootstrap concept is different from "connect" in several ways: `bootstrap()` will try to
/// connect to all peers which are specified in the config (`hard_coded_contacts`) or were
/// previously cached.
/// Once a connection with a peer succeeds, a `Connection` for such peer will be returned
/// and all other connections will be dropped.
///
/// # Example
///
/// ```
/// use qp2p::{QuicP2p, Config, Error};
/// use std::net::{IpAddr, Ipv4Addr, SocketAddr};
///
/// #[tokio::main]
/// async fn main() -> Result<(), Error> {
///
///     let mut config = Config::default();
///     config.local_ip = Some(IpAddr::V4(Ipv4Addr::LOCALHOST));
///     config.local_port = Some(3000);
///     let mut quic_p2p = QuicP2p::with_config(Some(config.clone()), Default::default(), true)?;
///     let (mut endpoint, _, _, _) = quic_p2p.new_endpoint().await?;
///     let peer_addr = endpoint.socket_addr();
///
///     config.local_port = Some(3001);
///     let mut quic_p2p = QuicP2p::with_config(Some(config), &[peer_addr], true)?;
///     let endpoint = quic_p2p.bootstrap().await?;
///     Ok(())
/// }
/// ```
Bootstrap to the network.
Bootstrap concept is different from "connect" in several ways: `bootstrap()` will try to
connect to all peers which are specified in the config (`hard_coded_contacts`) or were
previously cached.
Once a connection with a peer succeeds, a `Connection` for such peer will be returned
and all other connections will be dropped.
Bootstrap to the network . Bootstrap concept is different from " connect " in several ways : ` bootstrap () ` will try to connect to all peers which are specified in the config ( ` hard_coded_contacts ` ) or were previously cached . Once a connection with a peer succeeds a ` Connection ` for such peer will be returned and all other connections will be dropped .
pub async fn bootstrap(
        &self,
    ) -> Result<(
        Endpoint,
        IncomingConnections,
        IncomingMessages,
        DisconnectionEvents,
        SocketAddr,
    )> {
        let (endpoint, incoming_connections, incoming_message, disconnections) =
            self.new_endpoint().await?;
        let bootstrapped_peer = self
            .bootstrap_with(&endpoint, endpoint.bootstrap_nodes())
            .await?;
        Ok((
            endpoint,
            incoming_connections,
            incoming_message,
            disconnections,
            bootstrapped_peer,
        ))
    }
pub async fn bootstrap ( & self , ) -> Result < ( Endpoint , IncomingConnections , IncomingMessages , DisconnectionEvents , SocketAddr , ) > { let ( endpoint , incoming_connections , incoming_message , disconnections ) = self . new_endpoint ( ) . await ? ; let bootstrapped_peer = self . bootstrap_with ( & endpoint , endpoint . bootstrap_nodes ( ) ) . await ? ; Ok ( ( endpoint , incoming_connections , incoming_message , disconnections , bootstrapped_peer , ) ) }
Bootstrap to the network.
Bootstrap to the network .
&self
&self
example
```
use qp2p::{QuicP2p, Config, Error};
use std::net::{IpAddr, Ipv4Addr, SocketAddr}.
` ` ` use qp2p :: { QuicP2p Config Error } ; use std :: net :: { IpAddr Ipv4Addr SocketAddr } .
[tokio::main]
async fn main() -> Result<(), Error> {

let mut config = Config::default();
config.local_ip = Some(IpAddr::V4(Ipv4Addr::LOCALHOST));
config.local_port = Some(3000);
let mut quic_p2p = QuicP2p::with_config(Some(config.clone()), Default::default(), true)?;
let (mut endpoint, _, _, _) = quic_p2p.new_endpoint().await?;
let peer_addr = endpoint.socket_addr().

config.local_port = Some(3001);
let mut quic_p2p = QuicP2p::with_config(Some(config), &[peer_addr], true)?;
let endpoint = quic_p2p.bootstrap().await?;
Ok(())
}
```
async fn main () - > Result< () Error > { let mut config = Config :: default () ; config . local_ip = Some ( IpAddr :: V4 ( Ipv4Addr :: LOCALHOST )) ; config . local_port = Some ( 3000 ) ; let mut quic_p2p = QuicP2p :: with_config ( Some ( config . clone () ) Default :: default () true ) ? ; let ( mut endpoint _ _ _ ) = quic_p2p . new_endpoint () . await? ; let peer_addr = endpoint . socket_addr () . config . local_port = Some ( 3001 ) ; let mut quic_p2p = QuicP2p :: with_config ( Some ( config ) & [ peer_addr ] true ) ? ; let endpoint = quic_p2p . bootstrap () . await? ; Ok (( )) } ` ` `