pub struct AuthKeyStore { /* private fields */ }Expand description
Authentication key store — matches ntpsec’s key database.
Implementations§
Source§impl AuthKeyStore
impl AuthKeyStore
pub fn new() -> AuthKeyStore
pub fn add_key(&mut self, key: NtpAuthKey)
pub fn get_key(&self, id: u32) -> Option<&NtpAuthKey>
pub fn has_key(&self, id: u32) -> bool
pub fn remove_key(&mut self, id: u32)
pub fn key_count(&self) -> usize
pub fn add_trusted_key(&mut self, id: u32)
pub fn remove_trusted_key(&mut self, id: u32)
pub fn is_trusted_key(&self, id: u32) -> bool
pub fn set_control_key(&mut self, id: u32)
pub fn get_control_key(&self) -> Option<u32>
Sourcepub fn is_auth_enabled(&self) -> bool
pub fn is_auth_enabled(&self) -> bool
Returns true if authentication is enabled — i.e. there is at least
one configured key and at least one trusted key, or a control key is set.
Sourcepub fn parse_keys_file(&mut self, content: &str) -> Result<usize, String>
pub fn parse_keys_file(&mut self, content: &str) -> Result<usize, String>
Parse an ntp.keys file.
File format (matching ntpsec’s authreadkeys.c):
keyid digesttype keydata [trusted]
Comment lines start with #. Empty lines are ignored.
Sourcepub fn iter(&self) -> impl Iterator<Item = &NtpAuthKey>
pub fn iter(&self) -> impl Iterator<Item = &NtpAuthKey>
Iterate over all keys.
Trait Implementations§
Source§impl Debug for AuthKeyStore
impl Debug for AuthKeyStore
Source§impl Default for AuthKeyStore
impl Default for AuthKeyStore
Source§fn default() -> AuthKeyStore
fn default() -> AuthKeyStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AuthKeyStore
impl RefUnwindSafe for AuthKeyStore
impl Send for AuthKeyStore
impl Sync for AuthKeyStore
impl Unpin for AuthKeyStore
impl UnsafeUnpin for AuthKeyStore
impl UnwindSafe for AuthKeyStore
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