pub struct TenantSet { /* private fields */ }Expand description
An immutable, validated snapshot of every tenant and outstanding code.
Implementations§
Source§impl TenantSet
impl TenantSet
Sourcepub fn new(tenants: Vec<Tenant>, codes: Vec<EnrollCode>) -> Result<Self>
pub fn new(tenants: Vec<Tenant>, codes: Vec<EnrollCode>) -> Result<Self>
Builds a snapshot, rejecting anything that would make identification or routing ambiguous: duplicate names, duplicate hosts, a PSK shared by two entries, an empty host, or a zero connection limit.
pub fn tenants(&self) -> &[Tenant]
pub fn codes(&self) -> &[EnrollCode]
pub fn tenant(&self, name: &str) -> Option<&Tenant>
Sourcepub fn tenant_by_sni(&self, sni: &str) -> Option<&Tenant>
pub fn tenant_by_sni(&self, sni: &str) -> Option<&Tenant>
The enabled tenant routed by sni, if any.
Sourcepub fn candidates(&self, now_unix: u64) -> Candidates
pub fn candidates(&self, now_unix: u64) -> Candidates
PSKs worth trying at now_unix seconds: enabled tenants and codes that
have not expired.
Source§impl TenantSet
Edits. Each returns a new validated set and leaves self untouched.
impl TenantSet
Edits. Each returns a new validated set and leaves self untouched.
pub fn with_tenant(&self, tenant: Tenant) -> Result<Self>
pub fn with_code(&self, code: EnrollCode) -> Result<Self>
pub fn without_tenant(&self, name: &str) -> Result<Self>
pub fn with_disabled(&self, name: &str, disabled: bool) -> Result<Self>
Trait Implementations§
impl Eq for TenantSet
impl StructuralPartialEq for TenantSet
Auto Trait Implementations§
impl Freeze for TenantSet
impl RefUnwindSafe for TenantSet
impl Send for TenantSet
impl Sync for TenantSet
impl Unpin for TenantSet
impl UnsafeUnpin for TenantSet
impl UnwindSafe for TenantSet
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