pub struct DhtConfig {
pub kbucket_pending_timeout: Duration,
pub local_id: Option<[u8; 32]>,
pub commands: HashSet<usize>,
pub query_config: QueryConfig,
pub io_config: IoConfig,
pub bootstrap_interval: Duration,
pub ping_interval: Duration,
pub connection_idle_timeout: Duration,
pub adaptive: bool,
pub bootstrap_nodes: Vec<SocketAddr>,
pub socket: Option<MessageDataStream>,
}Fields§
§kbucket_pending_timeout: Duration§local_id: Option<[u8; 32]>§commands: HashSet<usize>§query_config: QueryConfig§io_config: IoConfig§bootstrap_interval: Duration§ping_interval: Duration§connection_idle_timeout: Duration§adaptive: bool§bootstrap_nodes: Vec<SocketAddr>§socket: Option<MessageDataStream>Implementations§
Source§impl DhtConfig
impl DhtConfig
Sourcepub fn bind<A: ToSocketAddrs>(self, addr: A) -> Result<Self>
pub fn bind<A: ToSocketAddrs>(self, addr: A) -> Result<Self>
Create a new UDP socket and attempt to bind it to the addr provided.
pub fn add_bootstrap_node<A: Into<SocketAddr>>(self, addr: A) -> Self
pub fn empty_bootstrap_nodes(self) -> Self
Sourcepub fn set_bootstrap_nodes<T: ToSocketAddrs>(self, addresses: &[T]) -> Self
pub fn set_bootstrap_nodes<T: ToSocketAddrs>(self, addresses: &[T]) -> Self
Set the nodes to bootstrap from
Sourcepub fn register_commands(self, cmds: &[usize]) -> Self
pub fn register_commands(self, cmds: &[usize]) -> Self
Register all commands to listen to.
Sourcepub fn set_ephemeral(self, ephemeral: bool) -> Self
pub fn set_ephemeral(self, ephemeral: bool) -> Self
Set ephemeral value. When true this node won’t expose its id to remote peer, so other peers do not add us to the peer list.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DhtConfig
impl !UnwindSafe for DhtConfig
impl Freeze for DhtConfig
impl Send for DhtConfig
impl Sync for DhtConfig
impl Unpin for DhtConfig
impl UnsafeUnpin for DhtConfig
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