Struct keynesis_network::Accepting
source · [−]pub struct Accepting<I, O, RNG, K = SecretKey> { /* private fields */ }
Expand description
accept incoming handshake
upon opening an ASMTP session with our node, the initiator will send the initial handshake to authenticate themselves and the responser is required to respond accordingly.
This object offers the necessary tooling to identify the initiator so it is possible to deny the connection early enough (see Accepting::accept)
Implementations
sourceimpl<I, O, K, RNG> Accepting<I, O, RNG, K> where
I: AsyncRead + Unpin,
O: AsyncWrite + Unpin,
K: Dh,
RNG: CryptoRng + RngCore,
impl<I, O, K, RNG> Accepting<I, O, RNG, K> where
I: AsyncRead + Unpin,
O: AsyncWrite + Unpin,
K: Dh,
RNG: CryptoRng + RngCore,
sourcepub async fn accept<F>(self, k: &K, check_id: F) -> Result<Handle<I, O>> where
F: Fn(&PublicKey) -> bool,
pub async fn accept<F>(self, k: &K, check_id: F) -> Result<Handle<I, O>> where
F: Fn(&PublicKey) -> bool,
perform the initial handshake with the peer
Upon receiving the initial handshake message, the function check_id
will
verify the public key of the user. For example the user can maintain a list
of unwelcome public keys.
If the peer is accepted and is using a supported version of the protocol then the functions replies the response handshake.
Errors
This function may fail for IO operations as well as for processing the noise handshake.
Auto Trait Implementations
impl<I, O, RNG, K> RefUnwindSafe for Accepting<I, O, RNG, K> where
I: RefUnwindSafe,
K: RefUnwindSafe,
O: RefUnwindSafe,
RNG: RefUnwindSafe,
impl<I, O, RNG, K> Send for Accepting<I, O, RNG, K> where
I: Send,
K: Send,
O: Send,
RNG: Send,
impl<I, O, RNG, K> Sync for Accepting<I, O, RNG, K> where
I: Sync,
K: Sync,
O: Sync,
RNG: Sync,
impl<I, O, RNG, K> Unpin for Accepting<I, O, RNG, K> where
I: Unpin,
K: Unpin,
O: Unpin,
RNG: Unpin,
impl<I, O, RNG, K> UnwindSafe for Accepting<I, O, RNG, K> where
I: UnwindSafe,
K: UnwindSafe,
O: UnwindSafe,
RNG: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more