pub struct Network(/* private fields */);Implementations§
Source§impl Network
impl Network
pub fn builder() -> NetworkBuilder<((),)>
Sourcepub fn remote_addr(&self) -> &Address
pub fn remote_addr(&self) -> &Address
The public address of this node.
Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
The listening address of this node.
Sourcepub fn is_active(&self, peer_id: &PeerId) -> bool
pub fn is_active(&self, peer_id: &PeerId) -> bool
Returns true if the peer is currently connected.
Sourcepub fn peer(&self, peer_id: &PeerId) -> Option<Peer>
pub fn peer(&self, peer_id: &PeerId) -> Option<Peer>
Returns a connection wrapper for the specified peer.
Sourcepub fn known_peers(&self) -> &KnownPeers
pub fn known_peers(&self) -> &KnownPeers
A set of known peers.
Sourcepub async fn connect<T>(
&self,
addr: T,
peer_id: &PeerId,
) -> Result<Peer, ConnectionError>
pub async fn connect<T>( &self, addr: T, peer_id: &PeerId, ) -> Result<Peer, ConnectionError>
Initiate a connection to the specified peer.
pub fn disconnect(&self, peer_id: &PeerId)
pub async fn shutdown(&self)
pub fn is_closed(&self) -> bool
pub fn sign_tl<T: TlWrite>(&self, data: T) -> [u8; 64]
pub fn sign_raw(&self, data: &[u8]) -> [u8; 64]
pub fn sign_peer_info(&self, now: u32, ttl: u32) -> PeerInfo
pub fn downgrade(this: &Self) -> WeakNetwork
Sourcepub fn max_frame_size(&self) -> usize
pub fn max_frame_size(&self) -> usize
returns the maximum size which can be potentially sent in a single frame
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Network
impl !RefUnwindSafe for Network
impl Send for Network
impl Sync for Network
impl Unpin for Network
impl !UnwindSafe for Network
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more