Struct ServerFilter

Source
pub struct ServerFilter<'a, S, FilterFn, AsyncBool>(/* private fields */);
Expand description

A future that accepts a secret-handshake based on a filter function and then yields a channel that encrypts/decrypts all data via box-stream.

Implementations§

Source§

impl<'a, S, FilterFn, AsyncBool> ServerFilter<'a, S, FilterFn, AsyncBool>
where S: AsyncRead + AsyncWrite, FilterFn: FnOnce(&PublicKey) -> AsyncBool, AsyncBool: Future<Item = bool>,

Source

pub fn new( stream: S, filter_fn: FilterFn, network_identifier: &'a [u8; 32], server_longterm_pk: &'a PublicKey, server_longterm_sk: &'a SecretKey, server_ephemeral_pk: &'a PublicKey, server_ephemeral_sk: &'a SecretKey, ) -> ServerFilter<'a, S, FilterFn, AsyncBool>

Create a new ServerFilter to accept a connection from a client which knows the server’s public key, uses the right app key over the given stream and whose longterm public key is accepted by the filter function.

Ephemeral keypairs can be generated via sodiumoxide::crypto::box_::gen_keypair.

Trait Implementations§

Source§

impl<'a, S, FilterFn, AsyncBool> Future for ServerFilter<'a, S, FilterFn, AsyncBool>
where S: AsyncRead + AsyncWrite, FilterFn: FnOnce(&PublicKey) -> AsyncBool, AsyncBool: Future<Item = bool>,

Source§

type Item = (BoxDuplex<S>, PublicKey)

On success, the result contains the encrypted connection and the longterm public key of the client.

Source§

type Error = (FilteringHandshakeError<<AsyncBool as Future>::Error>, S)

An error
Source§

fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Self::Item, Self::Error>

Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more

Auto Trait Implementations§

§

impl<'a, S, FilterFn, AsyncBool> Freeze for ServerFilter<'a, S, FilterFn, AsyncBool>
where S: Freeze, FilterFn: Freeze, AsyncBool: Freeze,

§

impl<'a, S, FilterFn, AsyncBool> RefUnwindSafe for ServerFilter<'a, S, FilterFn, AsyncBool>
where S: RefUnwindSafe, FilterFn: RefUnwindSafe, AsyncBool: RefUnwindSafe,

§

impl<'a, S, FilterFn, AsyncBool> !Send for ServerFilter<'a, S, FilterFn, AsyncBool>

§

impl<'a, S, FilterFn, AsyncBool> !Sync for ServerFilter<'a, S, FilterFn, AsyncBool>

§

impl<'a, S, FilterFn, AsyncBool> Unpin for ServerFilter<'a, S, FilterFn, AsyncBool>
where S: Unpin, FilterFn: Unpin, AsyncBool: Unpin,

§

impl<'a, S, FilterFn, AsyncBool> UnwindSafe for ServerFilter<'a, S, FilterFn, AsyncBool>
where S: UnwindSafe, FilterFn: UnwindSafe, AsyncBool: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F> IntoFuture for F
where F: Future,

Source§

type Future = F

The future that this type can be converted into.
Source§

type Item = <F as Future>::Item

The item that the future may resolve with.
Source§

type Error = <F as Future>::Error

The error that the future may resolve with.
Source§

fn into_future(self) -> F

Consumes this object and produces a future.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.