Struct litep2p::addresses::PublicAddresses
source · pub struct PublicAddresses { /* private fields */ }
Expand description
Set of the public addresses of the local node.
The format of the addresses stored in the set contain the local peer ID.
This requirement is enforced by the PublicAddresses::add_address
method,
that will add the local peer ID to the address if it is missing.
§Note
-
The addresses are reported to the identify protocol and are used by other nodes to establish a connection with the local node.
-
Users must ensure that the addresses are reachable from the network.
Implementations§
source§impl PublicAddresses
impl PublicAddresses
sourcepub fn add_address(&self, address: Multiaddr) -> Result<bool, InsertionError>
pub fn add_address(&self, address: Multiaddr) -> Result<bool, InsertionError>
Add a public address to the list of addresses.
The address must contain the local peer ID, otherwise an error is returned. In case the address does not contain any peer ID, it will be added.
Returns true if the address was added, false if it was already present.
sourcepub fn remove_address(&self, address: &Multiaddr) -> bool
pub fn remove_address(&self, address: &Multiaddr) -> bool
Remove the exact public address.
The provided address must contain the local peer ID.
sourcepub fn get_addresses(&self) -> Vec<Multiaddr>
pub fn get_addresses(&self) -> Vec<Multiaddr>
Returns a vector of the available listen addresses.
Trait Implementations§
source§impl Clone for PublicAddresses
impl Clone for PublicAddresses
source§fn clone(&self) -> PublicAddresses
fn clone(&self) -> PublicAddresses
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for PublicAddresses
impl !RefUnwindSafe for PublicAddresses
impl Send for PublicAddresses
impl Sync for PublicAddresses
impl Unpin for PublicAddresses
impl !UnwindSafe for PublicAddresses
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)