mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 23:01:33 +00:00
refactor(swarm)!: deprecate PollParameters
where possible (#3153)
This patch deprecates 3 out of 4 functions on `PollParameters`: - `local_peer_id` - `listened_addresses` - `external_addresses` The addresses can be obtained by inspecting the `FromSwarm` event. To make this easier, we introduce two utility structs in `libp2p-swarm`: - `ExternalAddresses` - `ListenAddresses` A node's `PeerId` is always known to the caller, thus we can require them to pass it in. Related: #3124.
This commit is contained in:
@ -63,7 +63,7 @@ async fn create_swarm(config: Config) -> Result<Swarm<Behaviour>, Box<dyn Error>
|
||||
.authenticate(libp2p_noise::NoiseAuthenticated::xx(&id_keys).unwrap())
|
||||
.multiplex(libp2p_yamux::YamuxConfig::default())
|
||||
.boxed();
|
||||
let behaviour = Behaviour::new(config)?;
|
||||
let behaviour = Behaviour::new(config, peer_id)?;
|
||||
let mut swarm = Swarm::with_async_std_executor(transport, behaviour, peer_id);
|
||||
swarm.listen_on("/ip4/0.0.0.0/tcp/0".parse()?)?;
|
||||
Ok(swarm)
|
||||
|
Reference in New Issue
Block a user