Struct secret_stream::ServerFilter
[−]
[src]
pub struct ServerFilter<'a, S, FilterFn, AsyncBool>(_);
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.
Methods
impl<'a, S, FilterFn, AsyncBool> ServerFilter<'a, S, FilterFn, AsyncBool> where
S: AsyncRead + AsyncWrite,
FilterFn: FnOnce(&PublicKey) -> AsyncBool,
AsyncBool: Future<Item = bool>,
[src]
S: AsyncRead + AsyncWrite,
FilterFn: FnOnce(&PublicKey) -> AsyncBool,
AsyncBool: Future<Item = bool>,
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>
[src]
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
impl<'a, S, FilterFn, AsyncBool> Future for ServerFilter<'a, S, FilterFn, AsyncBool> where
S: AsyncRead + AsyncWrite,
FilterFn: FnOnce(&PublicKey) -> AsyncBool,
AsyncBool: Future<Item = bool>,
[src]
S: AsyncRead + AsyncWrite,
FilterFn: FnOnce(&PublicKey) -> AsyncBool,
AsyncBool: Future<Item = bool>,
type Item = (BoxDuplex<S>, PublicKey)
On success, the result contains the encrypted connection and the longterm public key of the client.
type Error = (FilteringHandshakeError<AsyncBool::Error>, S)
An error
fn poll(&mut self, cx: &mut Context) -> Poll<Self::Item, Self::Error>
[src]
Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more