mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-24 15:21:33 +00:00
feat(libp2p): add SwarmBuilder
Introduce the new `libp2p::SwarmBuilder`. Users should use the new `libp2p::SwarmBuilder` instead of the now deprecated `libp2p::swarm::SwarmBuilder`. See `libp2p::SwarmBuilder` docs on how to use the new builder. Fixes #3657. Fixes #3563. Fixes #3179. Pull-Request: #4120.
This commit is contained in:
@ -31,7 +31,7 @@ use libp2p_core::{
|
||||
};
|
||||
use libp2p_identity::PeerId;
|
||||
use libp2p_perf::{Run, RunDuration, RunParams};
|
||||
use libp2p_swarm::{NetworkBehaviour, Swarm, SwarmBuilder, SwarmEvent};
|
||||
use libp2p_swarm::{Config, NetworkBehaviour, Swarm, SwarmEvent};
|
||||
use log::{error, info};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -414,11 +414,15 @@ async fn swarm<B: NetworkBehaviour + Default>() -> Result<Swarm<B>> {
|
||||
.boxed()
|
||||
};
|
||||
|
||||
Ok(
|
||||
SwarmBuilder::with_tokio_executor(transport, Default::default(), local_peer_id)
|
||||
.substream_upgrade_protocol_override(upgrade::Version::V1Lazy)
|
||||
.build(),
|
||||
)
|
||||
let swarm = Swarm::new(
|
||||
transport,
|
||||
Default::default(),
|
||||
local_peer_id,
|
||||
Config::with_tokio_executor()
|
||||
.with_substream_upgrade_protocol_override(upgrade::Version::V1Lazy),
|
||||
);
|
||||
|
||||
Ok(swarm)
|
||||
}
|
||||
|
||||
async fn connect(
|
||||
|
Reference in New Issue
Block a user