pub struct AsyncSecretConnection<Io> { /* private fields */ }Available on crate feature
async only.Expand description
Encrypted connection between peers in a CometBFT network, implemented using asynchronous I/O provided by the Tokio async runtime.
Implementations§
Source§impl<Io: AsyncReadExt + AsyncWriteExt + Send + Sync + Unpin> AsyncSecretConnection<Io>
impl<Io: AsyncReadExt + AsyncWriteExt + Send + Sync + Unpin> AsyncSecretConnection<Io>
Sourcepub async fn new<Identity>(io: Io, identity_key: &Identity) -> Result<Self>
pub async fn new<Identity>(io: Io, identity_key: &Identity) -> Result<Self>
Performs a handshake and returns a new AsyncSecretConnection, authenticating ourselves
with the provided Identity (Ed25519 signing key).
The IdentitySecret type can be used as an identity_key.
§Errors
- if sharing of the pubkey fails
- if sharing of the signature fails
- if receiving the signature fails
- if verifying the signature fails
Source§impl<Io> AsyncSecretConnection<Io>
impl<Io> AsyncSecretConnection<Io>
Sourcepub fn local_public_key(&self) -> &PublicKey
pub fn local_public_key(&self) -> &PublicKey
Get the local (i.e. our) PublicKey.
Sourcepub fn peer_public_key(&self) -> &PublicKey
pub fn peer_public_key(&self) -> &PublicKey
Returns the remote peer’s PublicKey.
Sourcepub fn split(self) -> (AsyncSecretReader<Io>, AsyncSecretWriter<Io>)
pub fn split(self) -> (AsyncSecretReader<Io>, AsyncSecretWriter<Io>)
Split this AsyncSecretConnection into an AsyncSecretReader and AsyncSecretWriter
which can be used independently of each other.
Trait Implementations§
Source§impl<Io: AsyncReadExt + Send + Sync + Unpin> AsyncReadMsg for AsyncSecretConnection<Io>
impl<Io: AsyncReadExt + Send + Sync + Unpin> AsyncReadMsg for AsyncSecretConnection<Io>
Source§impl<Io: AsyncWriteExt + Send + Sync + Unpin> AsyncWriteMsg for AsyncSecretConnection<Io>
impl<Io: AsyncWriteExt + Send + Sync + Unpin> AsyncWriteMsg for AsyncSecretConnection<Io>
Auto Trait Implementations§
impl<Io> Freeze for AsyncSecretConnection<Io>
impl<Io> RefUnwindSafe for AsyncSecretConnection<Io>
impl<Io> Send for AsyncSecretConnection<Io>where
Io: Send,
impl<Io> Sync for AsyncSecretConnection<Io>where
Io: Sync,
impl<Io> Unpin for AsyncSecretConnection<Io>
impl<Io> UnwindSafe for AsyncSecretConnection<Io>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more