diff --git a/p2p/cuprate-p2p/src/lib.rs b/p2p/cuprate-p2p/src/lib.rs index b244c57a..27ac0d0b 100644 --- a/p2p/cuprate-p2p/src/lib.rs +++ b/p2p/cuprate-p2p/src/lib.rs @@ -1,10 +1,7 @@ //! Cuprate's P2P Crate. //! -//! This crate contains a [`ClientPool`](client_pool::ClientPool) which holds connected peers on a single [`NetworkZone`]. -//! -//! This crate also contains the different routing methods that control how messages should be sent, i.e. broadcast to all, -//! or send to a single peer. -//! +//! This crate contains a [`NetworkInterface`] which allows interacting with the Monero P2P network on +//! a certain [`NetworkZone`] use std::sync::Arc; @@ -147,20 +144,25 @@ pub struct NetworkInterface { } impl NetworkInterface { + /// Returns a service which allows broadcasting messages to all the connected peers in a specific [`NetworkZone`]. pub fn broadcast_svc(&self) -> BroadcastSvc { self.broadcast_svc.clone() } + /// Returns a stream which yields the highest seen sync state from a connected peer. pub fn top_sync_stream(&self) -> WatchStream { WatchStream::from_changes(self.top_block_watch.clone()) } + /// Returns the address book service. pub fn address_book( &self, ) -> BoxCloneService, AddressBookResponse, tower::BoxError> { self.address_book.clone() } + /// Pulls a client from the client pool, returning it in a guard that will return it there when it's + /// dropped. pub fn borrow_client(&self, peer: &InternalPeerID) -> Option> { self.pool.borrow_client(peer) }