Deprecate secio. (#1729)

SECIO is removed from all libp2p implementations.
See https://blog.ipfs.io/2020-08-07-deprecating-secio/.
This commit is contained in:
Roman Borschel
2020-09-07 12:13:10 +02:00
committed by GitHub
parent c94262d03a
commit ed5aec14f3
17 changed files with 62 additions and 78 deletions

View File

@ -41,7 +41,7 @@ use libp2p::{
multiaddr::Protocol,
ping::{self, Ping, PingConfig, PingEvent},
pnet::{PnetConfig, PreSharedKey},
secio::SecioConfig,
noise,
swarm::NetworkBehaviourEventProcess,
tcp::TcpConfig,
yamux::Config as YamuxConfig,
@ -76,7 +76,8 @@ pub fn build_transport(
Dial = impl Send,
ListenerUpgrade = impl Send,
> + Clone {
let secio_config = SecioConfig::new(key_pair);
let noise_keys = noise::Keypair::<noise::X25519Spec>::new().into_authentic(&key_pair).unwrap();
let noise_config = noise::NoiseConfig::xx(noise_keys).into_authenticated();
let yamux_config = YamuxConfig::default();
let base_transport = TcpConfig::new().nodelay(true);
@ -88,7 +89,7 @@ pub fn build_transport(
};
maybe_encrypted
.upgrade(Version::V1)
.authenticate(secio_config)
.authenticate(noise_config)
.multiplex(yamux_config)
.timeout(Duration::from_secs(20))
}