Struct floresta_wire::address_man::AddressMan
source · pub struct AddressMan { /* private fields */ }
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)>
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<()>
pub fn start_addr_man( &mut self, datadir: String, default_port: u16, network: Network, dns_seeds: &[DnsSeed] ) -> Result<Vec<LocalAddress>, Error>
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 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 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