Struct litep2p::config::ConfigBuilder
source · pub struct ConfigBuilder { /* private fields */ }
Expand description
Configuration builder for Litep2p
.
Implementations§
source§impl ConfigBuilder
impl ConfigBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Create empty ConfigBuilder
.
sourcepub fn with_tcp(self, config: TcpConfig) -> Self
pub fn with_tcp(self, config: TcpConfig) -> Self
Add TCP transport configuration, enabling the transport.
sourcepub fn with_websocket(self, config: WebSocketConfig) -> Self
pub fn with_websocket(self, config: WebSocketConfig) -> Self
Add WebSocket transport configuration, enabling the transport.
sourcepub fn with_keypair(self, keypair: Keypair) -> Self
pub fn with_keypair(self, keypair: Keypair) -> Self
Add keypair.
If no keypair is specified, litep2p creates a new keypair.
sourcepub fn with_notification_protocol(self, config: Config) -> Self
pub fn with_notification_protocol(self, config: Config) -> Self
Enable notification protocol.
sourcepub fn with_libp2p_ping(self, config: Config) -> Self
pub fn with_libp2p_ping(self, config: Config) -> Self
Enable IPFS Ping protocol.
sourcepub fn with_libp2p_identify(self, config: Config) -> Self
pub fn with_libp2p_identify(self, config: Config) -> Self
Enable IPFS Identify protocol.
sourcepub fn with_libp2p_kademlia(self, config: Config) -> Self
pub fn with_libp2p_kademlia(self, config: Config) -> Self
Enable IPFS Kademlia protocol.
sourcepub fn with_libp2p_bitswap(self, config: Config) -> Self
pub fn with_libp2p_bitswap(self, config: Config) -> Self
Enable IPFS Bitswap protocol.
sourcepub fn with_request_response_protocol(self, config: Config) -> Self
pub fn with_request_response_protocol(self, config: Config) -> Self
Enable request-response protocol.
sourcepub fn with_user_protocol(self, protocol: Box<dyn UserProtocol>) -> Self
pub fn with_user_protocol(self, protocol: Box<dyn UserProtocol>) -> Self
Enable user protocol.
sourcepub fn with_mdns(self, config: MdnsConfig) -> Self
pub fn with_mdns(self, config: MdnsConfig) -> Self
Enable mDNS for peer discoveries in the local network.
sourcepub fn with_known_addresses(
self,
addresses: impl Iterator<Item = (PeerId, Vec<Multiaddr>)>,
) -> Self
pub fn with_known_addresses( self, addresses: impl Iterator<Item = (PeerId, Vec<Multiaddr>)>, ) -> Self
Add known address(es) for one or more peers.
sourcepub fn with_executor(self, executor: Arc<dyn Executor>) -> Self
pub fn with_executor(self, executor: Arc<dyn Executor>) -> Self
Add executor for running futures spawned by litep2p
.
If no executor is specified, litep2p
defaults to calling tokio::spawn()
.
sourcepub fn with_max_parallel_dials(self, max_parallel_dials: usize) -> Self
pub fn with_max_parallel_dials(self, max_parallel_dials: usize) -> Self
How many addresses should litep2p attempt to dial in parallel.
sourcepub fn with_connection_limits(self, config: ConnectionLimitsConfig) -> Self
pub fn with_connection_limits(self, config: ConnectionLimitsConfig) -> Self
Set connection limits configuration.
sourcepub fn with_keep_alive_timeout(self, timeout: Duration) -> Self
pub fn with_keep_alive_timeout(self, timeout: Duration) -> Self
Set keep alive timeout for connections.
sourcepub fn build(self) -> Litep2pConfig
pub fn build(self) -> Litep2pConfig
Build Litep2pConfig
.