mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 17:41:22 +00:00
feat(noise): remove deprecated legacy handshakes
This patch removes all deprecated legacy code from `libp2p-noise` and attempts to collapse all the abstraction layers into something a lot simpler. Pull-Request: #3511.
This commit is contained in:
@ -92,17 +92,18 @@
|
||||
//! An example of initialising a gossipsub compatible swarm:
|
||||
//!
|
||||
//! ```
|
||||
//! use libp2p_gossipsub::Event;
|
||||
//! use libp2p_core::{identity::Keypair,transport::{Transport, MemoryTransport}, Multiaddr};
|
||||
//! use libp2p_gossipsub::MessageAuthenticity;
|
||||
//! let local_key = Keypair::generate_ed25519();
|
||||
//! let local_peer_id = libp2p_core::PeerId::from(local_key.public());
|
||||
//! # use libp2p_gossipsub::Event;
|
||||
//! # use libp2p_core::{transport::{Transport, MemoryTransport}, Multiaddr};
|
||||
//! # use libp2p_gossipsub::MessageAuthenticity;
|
||||
//! # use libp2p_identity as identity;
|
||||
//! let local_key = identity::Keypair::generate_ed25519();
|
||||
//! let local_peer_id = local_key.public().to_peer_id();
|
||||
//!
|
||||
//! // Set up an encrypted TCP Transport over the Mplex
|
||||
//! // This is test transport (memory).
|
||||
//! let transport = MemoryTransport::default()
|
||||
//! .upgrade(libp2p_core::upgrade::Version::V1)
|
||||
//! .authenticate(libp2p_noise::NoiseAuthenticated::xx(&local_key).unwrap())
|
||||
//! .authenticate(libp2p_noise::Config::new(&local_key).unwrap())
|
||||
//! .multiplex(libp2p_mplex::MplexConfig::new())
|
||||
//! .boxed();
|
||||
//!
|
||||
@ -123,11 +124,11 @@
|
||||
//! // subscribe to the topic
|
||||
//! gossipsub.subscribe(&topic);
|
||||
//! // create the swarm (use an executor in a real example)
|
||||
//! libp2p_swarm::Swarm::without_executor(
|
||||
//! libp2p_swarm::SwarmBuilder::without_executor(
|
||||
//! transport,
|
||||
//! gossipsub,
|
||||
//! local_peer_id,
|
||||
//! )
|
||||
//! ).build()
|
||||
//! };
|
||||
//!
|
||||
//! // Listen on a memory transport.
|
||||
|
Reference in New Issue
Block a user