Crate tetsy_libp2p_secio[−][src]
The secio
protocol is a middleware that will encrypt and decrypt communications going
through a socket (or anything that implements AsyncRead + AsyncWrite
).
Usage
The SecioConfig
implements InboundUpgrade
and OutboundUpgrade
and thus
serves as a connection upgrade for authentication of a transport.
See authenticate
.
use futures::prelude::*; use tetsy_libp2p_secio::{SecioConfig, SecioOutput}; use tetsy_libp2p_core::{PeerId, Multiaddr, identity, upgrade}; use tetsy_libp2p_core::transport::Transport; use tetsy_libp2p_mplex::MplexConfig; use tetsy_libp2p_tcp::TcpConfig; // Create a local peer identity. let local_keys = identity::Keypair::generate_ed25519(); // Create a `Transport`. let transport = TcpConfig::new() .upgrade(upgrade::Version::V1) .authenticate(SecioConfig::new(local_keys.clone())) .multiplex(MplexConfig::default()); // The transport can be used with a `Network` from `tetsy-libp2p-core`, or a // `Swarm` from from `tetsy-libp2p-swarm`. See the documentation of these // crates for mode details. // let network = Network::new(transport, local_keys.public().into_peer_id()); // let swarm = Swarm::new(transport, behaviour, local_keys.public().into_peer_id());
Structs
SecioConfig | Implementation of the |
SecioMiddleware | Wraps around an object that implements |
SecioOutput | Output of the secio protocol. |
Enums
Cipher | Possible encryption ciphers. |
Digest | Possible digest algorithms. |
KeyAgreement | Possible key agreement algorithms. |
SecioError | Error at the SECIO layer communication. |