pub struct IdentityRegistry { /* private fields */ }Expand description
Registrar for SNAPtun static identities.
Implementations§
Source§impl IdentityRegistry
impl IdentityRegistry
Returns true iff the identity is authorized to send packets at time
now.
Eventually, this method should return the PSK under which the identity is authorized.
Sourcepub fn register<S: AsRef<str>>(
&self,
now: Instant,
key: S,
ident: [u8; 32],
lifetime: Duration,
) -> bool
pub fn register<S: AsRef<str>>( &self, now: Instant, key: S, ident: [u8; 32], lifetime: Duration, ) -> bool
Registers a new identity, associated with key key and with the given
lifetime. There can be at most one identity registered per key. If an
identity already exists, it is overwritten. The method is indempotent.
§Return value
Returns true if no registration existed before; otherwise false.
Sourcepub fn remove_expired(&self, now: Instant)
pub fn remove_expired(&self, now: Instant)
Removes all expired entries.
Trait Implementations§
Source§impl SnapTunAuthorization for IdentityRegistry
impl SnapTunAuthorization for IdentityRegistry
Returns true iff the peer is allowed to send traffic to the server.
Auto Trait Implementations§
impl !Freeze for IdentityRegistry
impl RefUnwindSafe for IdentityRegistry
impl Send for IdentityRegistry
impl Sync for IdentityRegistry
impl Unpin for IdentityRegistry
impl UnsafeUnpin for IdentityRegistry
impl UnwindSafe for IdentityRegistry
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request