跳到主要内容

TicketRotator

结构体 TicketRotator 

Source
pub struct TicketRotator { /* private fields */ }
展开描述

A ticketer that has 一个 ‘current’ sub-ticketer 并 一个 single ‘previous’ ticketer. It creates 新 ticketer every so often, demoting the current ticketer.

实现§

Source§

impl TicketRotator

Source

pub fn new( lifetime: u32, generator: fn() -> Result<Box<dyn ProducesTickets>, GetRandomFailed>, ) -> Result<Self, Error>

Creates 新 TicketRotator, which rotates through sub-ticketers based on the passage of time.

lifetime is (单位:秒), 并 is how long the current ticketer is 用 到 generate new tickets. Tickets are 已接受 用于 no longer than twice this duration. generator produces 新 ProducesTickets implementation.

Trait 实现§

Source§

impl Debug for TicketRotator

Available on crate feature std only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

使用给定的格式化器格式化此值。 更多信息
Source§

impl ProducesTickets for TicketRotator

Available on crate feature std only.
Source§

fn lifetime(&self) -> u32

Returns the lifetime (单位:秒) of tickets produced now. 此 lifetime , as 一个 hint 到 clients that the ticket will not be useful after the given time. 更多信息
Source§

fn enabled(&self) -> bool

如果此实现会加密/解密 tickets. Should 返回 false if this 是 dummy implementation: the server will not send the SessionTicket extension 并 will not call the other functions.
Source§

fn encrypt(&self, message: &[u8]) -> Option<Vec<u8>>

Encrypt 并 authenticate plain, returning the resulting 票据 Return None if plain cannot be encrypted 用于 some reason: an empty ticket , sent 并 the connection will continue.
Source§

fn decrypt(&self, ciphertext: &[u8]) -> Option<Vec<u8>>

Decrypt cipher, validating its authenticity protection 并 recovering 明文. cipher is fully attacker controlled, so this decryption must be side-channel free, panic-proof, 并 otherwise bullet-proof. If the decryption fails, return None.

自动 Trait 实现§

Blanket 实现§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. 更多信息
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows 从 an owned value. 更多信息
Source§

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

Source§

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

Mutably borrows 从 an owned value. 更多信息
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

原样返回传入的参数。

Source§

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

Source§

fn into(self) -> U

Calls U::从(self)

That is, this conversion is whatever the implementation of From<T> 用于 U 的实现方式。

Source§

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

Source§

type Error = Infallible

转换出错时返回的类型。
Source§

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

执行转换。
Source§

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

Source§

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

转换出错时返回的类型。
Source§

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

执行转换。