mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-26 16:21:39 +00:00
Make InboundUpgrade for IK pattern more generic. (#1379)
The current implementation defines the InboundUpgrade only for `R = ()` so notably a `NoiseConfig` created by `NoiseConfig::ik_dialer` can not be an `InboundUpgrade`. Fixes #1378.
This commit is contained in:
@ -244,9 +244,9 @@ where
|
|||||||
|
|
||||||
// Handshake pattern IK /////////////////////////////////////////////////////
|
// Handshake pattern IK /////////////////////////////////////////////////////
|
||||||
|
|
||||||
impl<T, C> InboundUpgrade<T> for NoiseConfig<IK, C>
|
impl<T, C, R> InboundUpgrade<T> for NoiseConfig<IK, C, R>
|
||||||
where
|
where
|
||||||
NoiseConfig<IK, C>: UpgradeInfo,
|
NoiseConfig<IK, C, R>: UpgradeInfo,
|
||||||
T: AsyncRead + AsyncWrite + Unpin + Send + 'static,
|
T: AsyncRead + AsyncWrite + Unpin + Send + 'static,
|
||||||
C: Protocol<C> + AsRef<[u8]> + Zeroize + Send + 'static,
|
C: Protocol<C> + AsRef<[u8]> + Zeroize + Send + 'static,
|
||||||
{
|
{
|
||||||
|
@ -83,16 +83,7 @@ impl UpgradeInfo for NoiseConfig<XX, X25519> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UpgradeInfo for NoiseConfig<IK, X25519> {
|
impl<R> UpgradeInfo for NoiseConfig<IK, X25519, R> {
|
||||||
type Info = &'static [u8];
|
|
||||||
type InfoIter = std::iter::Once<Self::Info>;
|
|
||||||
|
|
||||||
fn protocol_info(&self) -> Self::InfoIter {
|
|
||||||
std::iter::once(b"/noise/ik/25519/chachapoly/sha256/0.1.0")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl UpgradeInfo for NoiseConfig<IK, X25519, (PublicKey<X25519>, identity::PublicKey)> {
|
|
||||||
type Info = &'static [u8];
|
type Info = &'static [u8];
|
||||||
type InfoIter = std::iter::Once<Self::Info>;
|
type InfoIter = std::iter::Once<Self::Info>;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user