Struct bip_dht::DhtBuilder
[−]
[src]
pub struct DhtBuilder { /* fields omitted */ }
Stores information for initializing a DHT.
Methods
impl DhtBuilder
[src]
fn with_node(node_addr: SocketAddr) -> DhtBuilder
Creates a DhtBuilder with an initial node for our routing table.
fn with_router(router: Router) -> DhtBuilder
Creates a DhtBuilder with an initial router which will let us gather nodes if our routing table is ever empty.
Difference between a node and a router is that a router is never put in our routing table.
fn add_node(self, node_addr: SocketAddr) -> DhtBuilder
Add nodes which will be distributed within our routing table.
fn add_router(self, router: Router) -> DhtBuilder
Add a router which will let us gather nodes if our routing table is ever empty.
See DhtBuilder::with_router for difference between a router and a node.
fn set_read_only(self, read_only: bool) -> DhtBuilder
Set the read only flag when communicating with other nodes. Indicates that remote nodes should not add us to their routing table.
Used when we are behind a restrictive NAT and/or we want to decrease incoming network traffic. Defaults value is true.
fn set_external_addr(self, addr: SocketAddr) -> DhtBuilder
Provide the DHT with our external address. If this is not supplied we will have to deduce this information from remote nodes.
Purpose of the external address is to generate a NodeId that conforms to BEP 42 so that nodes can safely store information on our node.
fn set_source_addr(self, addr: SocketAddr) -> DhtBuilder
Provide the DHT with the source address.
If this is not supplied we will use the OS default route.
fn start_mainline<H>(self, handshaker: H) -> Result<MainlineDht> where
H: Handshaker + 'static,
H: Handshaker + 'static,
Start a mainline DHT with the current configuration.
Trait Implementations
impl Clone for DhtBuilder
[src]
fn clone(&self) -> DhtBuilder
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more