diff --git a/example/examples/echo-dialer.rs b/example/examples/echo-dialer.rs index 097d3262..618a1e29 100644 --- a/example/examples/echo-dialer.rs +++ b/example/examples/echo-dialer.rs @@ -46,7 +46,7 @@ fn main() { .or_upgrade({ let private_key = include_bytes!("test-private-key.pk8"); let public_key = include_bytes!("test-public-key.der").to_vec(); - secio::SecioConnUpgrade { + secio::SecioConfig { key: secio::SecioKeyPair::rsa_from_pkcs8(private_key, public_key).unwrap(), } }); diff --git a/example/examples/echo-server.rs b/example/examples/echo-server.rs index 1447d030..f57f70b6 100644 --- a/example/examples/echo-server.rs +++ b/example/examples/echo-server.rs @@ -46,7 +46,7 @@ fn main() { .or_upgrade({ let private_key = include_bytes!("test-private-key.pk8"); let public_key = include_bytes!("test-public-key.der").to_vec(); - secio::SecioConnUpgrade { + secio::SecioConfig { key: secio::SecioKeyPair::rsa_from_pkcs8(private_key, public_key).unwrap(), } }); diff --git a/libp2p-secio/src/lib.rs b/libp2p-secio/src/lib.rs index 21c01be9..5fb2066c 100644 --- a/libp2p-secio/src/lib.rs +++ b/libp2p-secio/src/lib.rs @@ -29,7 +29,7 @@ //! `SecioMiddleware` that implements `Sink` and `Stream` and can be used to send packets of data. //! //! However for integration with the rest of `libp2p` you are encouraged to use the -//! `SecioConnUpgrade` struct instead. This struct implements the `ConnectionUpgrade` trait and +//! `SecioConfig` struct instead. This struct implements the `ConnectionUpgrade` trait and //! will automatically apply secio on any incoming or outgoing connection. extern crate bytes; @@ -68,7 +68,7 @@ mod structs_proto; /// Implementation of the `ConnectionUpgrade` trait of `libp2p_swarm`. Automatically applies any /// secio on any connection. #[derive(Clone)] -pub struct SecioConnUpgrade { +pub struct SecioConfig { /// Private and public keys of the local node. pub key: SecioKeyPair, } @@ -132,7 +132,7 @@ pub enum SecioPublicKey<'a> { Rsa(&'a [u8]), } -impl libp2p_swarm::ConnectionUpgrade for SecioConnUpgrade +impl libp2p_swarm::ConnectionUpgrade for SecioConfig where S: AsyncRead + AsyncWrite + 'static { type Output = RwStreamSink<