pub struct DnsHandle { /* private fields */ }Expand description
Handle for managing DNS records after server is started
This handle can be cloned and used to add/remove records while the server is running.
Implementations§
Source§impl DnsHandle
impl DnsHandle
Sourcepub async fn add_record(
&self,
hostname: &str,
ip: IpAddr,
) -> Result<(), DnsError>
pub async fn add_record( &self, hostname: &str, ip: IpAddr, ) -> Result<(), DnsError>
Add a DNS record for a hostname to IP mapping
Creates an A record for IPv4 addresses and an AAAA record for IPv6 addresses.
§Errors
Returns DnsError::InvalidName if the hostname is invalid.
Sourcepub async fn remove_record(&self, hostname: &str) -> Result<bool, DnsError>
pub async fn remove_record(&self, hostname: &str) -> Result<bool, DnsError>
Remove DNS records for a hostname (both A and AAAA)
Tombstones both record types since we don’t track which type was stored.
§Errors
Returns DnsError::InvalidName if the hostname is invalid.
Sourcepub fn zone_origin(&self) -> &Name
pub fn zone_origin(&self) -> &Name
Get the zone origin
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DnsHandle
impl !RefUnwindSafe for DnsHandle
impl Send for DnsHandle
impl Sync for DnsHandle
impl Unpin for DnsHandle
impl UnsafeUnpin for DnsHandle
impl !UnwindSafe for DnsHandle
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