pub struct DhtBuilder(/* private fields */);Expand description
A builder for the Dht node.
Implementations§
Source§impl DhtBuilder
impl DhtBuilder
Sourcepub fn server_mode(&mut self) -> &mut Self
pub fn server_mode(&mut self) -> &mut Self
Set this node’s server_mode.
Sourcepub fn server_settings(&mut self, server_settings: ServerSettings) -> &mut Self
pub fn server_settings(&mut self, server_settings: ServerSettings) -> &mut Self
Set a custom settings for the node to use at server mode.
Defaults to ServerSettings::default
Sourcepub fn bootstrap<T: ToSocketAddrs>(&mut self, bootstrap: &[T]) -> &mut Self
pub fn bootstrap<T: ToSocketAddrs>(&mut self, bootstrap: &[T]) -> &mut Self
Set bootstrapping nodes.
Sourcepub fn extra_bootstrap<T: ToSocketAddrs>(
&mut self,
extra_bootstrap: &[T],
) -> &mut Self
pub fn extra_bootstrap<T: ToSocketAddrs>( &mut self, extra_bootstrap: &[T], ) -> &mut Self
Add more bootstrap nodes to default bootstrapping nodes.
Useful when you want to augment the default bootstrapping nodes with dynamic list of nodes you have seen in previous sessions.
Sourcepub fn no_bootstrap(&mut self) -> &mut Self
pub fn no_bootstrap(&mut self) -> &mut Self
Remove the existing bootstrapping nodes, usually to create the first node in a new network.
Sourcepub fn public_ip(&mut self, public_ip: Ipv4Addr) -> &mut Self
pub fn public_ip(&mut self, public_ip: Ipv4Addr) -> &mut Self
A known public IPv4 address for this node to generate a secure node Id from according to BEP_0042
Defaults to depending on suggestions from responding nodes.
Sourcepub fn request_timeout(&mut self, request_timeout: Duration) -> &mut Self
pub fn request_timeout(&mut self, request_timeout: Duration) -> &mut Self
UDP socket request timeout duration.
The longer this duration is, the longer queries take until they are deemeed “done”. The shortet this duration is, the more responses from busy nodes we miss out on, which affects the accuracy of queries trying to find closest nodes to a target.
Defaults to crate::DEFAULT_REQUEST_TIMEOUT
Sourcepub fn bind_address(&mut self, bind_address: Ipv4Addr) -> &mut Self
pub fn bind_address(&mut self, bind_address: Ipv4Addr) -> &mut Self
Set the address to bind to.
Defaults to 0.0.0.0 (all interfaces).
Trait Implementations§
Source§impl Clone for DhtBuilder
impl Clone for DhtBuilder
Source§fn clone(&self) -> DhtBuilder
fn clone(&self) -> DhtBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more