pub struct HostMapReloader { /* private fields */ }Expand description
Tracks a hosts file and reloads it when the modification time changes.
Holds the base host map (from peer config aliases) and the current
effective map (base + hosts file). On each check_reload(), stats the
hosts file and rebuilds the effective map if the mtime has changed.
Implementations§
Source§impl HostMapReloader
impl HostMapReloader
Sourcepub fn new(base: HostMap, path: PathBuf) -> Self
pub fn new(base: HostMap, path: PathBuf) -> Self
Create a new reloader.
Performs the initial load of the hosts file and merges with the base map.
Sourcepub fn memory_only(base: HostMap) -> Self
pub fn memory_only(base: HostMap) -> Self
Create a memory-only reloader from the base host map.
Embedded applications use this to avoid probing daemon-oriented system
paths such as /etc/fips/hosts inside mobile sandboxes.
Sourcepub fn check_reload(&mut self) -> bool
pub fn check_reload(&mut self) -> bool
Check if the hosts file has been modified and reload if so.
Returns true if the map was reloaded.
Auto Trait Implementations§
impl Freeze for HostMapReloader
impl RefUnwindSafe for HostMapReloader
impl Send for HostMapReloader
impl Sync for HostMapReloader
impl Unpin for HostMapReloader
impl UnsafeUnpin for HostMapReloader
impl UnwindSafe for HostMapReloader
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 more