pub async fn state(session: Session) -> Result<Response<Body>, ServerError> {
        let conn = session.context.db.lock();
        let selected_peer = DatabasePeer::get(&conn, session.peer.id)?;

        let cidrs: Vec<_> = DatabaseCidr::list(&conn)?;

        let mut peers: Vec<_> = selected_peer
            .get_all_allowed_peers(&conn)?
            .into_iter()
            .map(|p| p.inner)
            .collect();
        inject_endpoints(&session, &mut peers);
        json_response(State { peers, cidrs })
    }
/// Get the current state of the network, in the eyes of the current peer.
///
/// This endpoint returns the visible CIDRs and Peers, providing all the necessary
/// information for the peer to create connections to all of them.
Get the current state of the network, in the eyes of the current peer.
This endpoint returns the visible CIDRs and Peers, providing all the necessary
information for the peer to create connections to all of them.
Get the current state of the network in the eyes of the current peer . This endpoint returns the visible CIDRs and Peers providing all the necessary information for the peer to create connections to all of them .
pub async fn state(session: Session) -> Result<Response<Body>, ServerError> {
        let conn = session.context.db.lock();
        let selected_peer = DatabasePeer::get(&conn, session.peer.id)?;
        let cidrs: Vec<_> = DatabaseCidr::list(&conn)?;
        let mut peers: Vec<_> = selected_peer
            .get_all_allowed_peers(&conn)?
            .into_iter()
            .map(|p| p.inner)
            .collect();
        inject_endpoints(&session, &mut peers);
        json_response(State { peers, cidrs })
    }
pub async fn state ( session : Session ) -> Result < Response < Body > , ServerError > { let conn = session . context . db . lock ( ) ; let selected_peer = DatabasePeer :: get ( & conn , session . peer . id ) ? ; let cidrs : Vec < _ > = DatabaseCidr :: list ( & conn ) ? ; let mut peers : Vec < _ > = selected_peer . get_all_allowed_peers ( & conn ) ? . into_iter ( ) . map ( | p | p . inner ) . collect ( ) ; inject_endpoints ( & session , & mut peers ) ; json_response ( State { peers , cidrs } ) }
Get the current state of the network, in the eyes of the current peer.
Get the current state of the network in the eyes of the current peer .
session
Session