pub struct DnsMap { /* private fields */ }Expand description
Thread-safe bidirectional map between fake IPv4 addresses and hostnames.
Fake IPs are allocated sequentially from subnet.0.0.1 upwards.
Implementations§
Source§impl DnsMap
impl DnsMap
Sourcepub fn get_or_alloc(&self, hostname: &str) -> Result<Ipv4Addr>
pub fn get_or_alloc(&self, hostname: &str) -> Result<Ipv4Addr>
Get or allocate a fake IP for hostname.
§Errors
Returns Err when the address space is exhausted (>= 16 million entries).
Sourcepub fn lookup_hostname(&self, ip: Ipv4Addr) -> Option<String>
pub fn lookup_hostname(&self, ip: Ipv4Addr) -> Option<String>
Reverse-lookup: hostname for a fake IP.
Sourcepub fn is_fake_ip(&self, ip: IpAddr) -> bool
pub fn is_fake_ip(&self, ip: IpAddr) -> bool
Check whether an IP belongs to this map’s subnet.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DnsMap
impl RefUnwindSafe for DnsMap
impl Send for DnsMap
impl Sync for DnsMap
impl Unpin for DnsMap
impl UnsafeUnpin for DnsMap
impl UnwindSafe for DnsMap
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