pub struct AddressMan { /* private fields */ }Available on non-WebAssembly only.
Expand description
A module that keeps track of know addresses and serve them to our node to connect
Implementations§
Source§impl AddressMan
impl AddressMan
Sourcepub fn push_addresses(&mut self, addresses: &[LocalAddress])
pub fn push_addresses(&mut self, addresses: &[LocalAddress])
Add a new address to our list of known address
pub fn get_addresses_to_send(&self) -> Vec<(AddrV2, u64, ServiceFlags, u16)>
pub fn get_seeds_from_dns( seed: &DnsSeed, default_port: u16, socks5: Option<SocketAddr>, ) -> Result<Vec<LocalAddress>, Error>
Sourcepub fn get_address_to_connect(
&mut self,
required_service: ServiceFlags,
feeler: bool,
) -> Option<(usize, LocalAddress)>
pub fn get_address_to_connect( &mut self, required_service: ServiceFlags, feeler: bool, ) -> Option<(usize, LocalAddress)>
Returns a new random address to open a new connection, we try to get addresses with a set of features supported for our peers
pub fn dump_peers(&self, datadir: &str) -> Result<()>
Sourcepub fn dump_utreexo_peers(
&self,
datadir: &str,
peers_id: &[usize],
) -> Result<()>
pub fn dump_utreexo_peers( &self, datadir: &str, peers_id: &[usize], ) -> Result<()>
Dumps the connected utreexo peers to a file on dir datadir/anchors.json in json format `
inputs are the directory to save the file and the list of ids of the connected utreexo peers
pub fn start_addr_man(&mut self, datadir: String) -> Vec<LocalAddress>
Sourcepub fn rearrange_buckets(&mut self)
pub fn rearrange_buckets(&mut self)
This function moves addresses between buckets, like if the ban time of a peer expired, or if we tried to connect to a peer and it failed in the past, but now it might be online again.
Sourcepub fn update_set_state(&mut self, idx: usize, state: AddressState) -> &mut Self
pub fn update_set_state(&mut self, idx: usize, state: AddressState) -> &mut Self
Updates the state of an address
Sourcepub fn update_set_service_flag(
&mut self,
idx: usize,
flags: ServiceFlags,
) -> &mut Self
pub fn update_set_service_flag( &mut self, idx: usize, flags: ServiceFlags, ) -> &mut Self
Updates the service flags after we receive a version message
Trait Implementations§
Source§impl Clone for AddressMan
impl Clone for AddressMan
Source§fn clone(&self) -> AddressMan
fn clone(&self) -> AddressMan
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for AddressMan
impl Default for AddressMan
Source§fn default() -> AddressMan
fn default() -> AddressMan
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AddressMan
impl RefUnwindSafe for AddressMan
impl Send for AddressMan
impl Sync for AddressMan
impl Unpin for AddressMan
impl UnwindSafe for AddressMan
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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