pub struct NsupdateExecutor { /* private fields */ }Expand description
nsupdate command executor
Manages dynamic DNS updates via the nsupdate command-line tool. Supports TSIG authentication for secure updates.
Implementations§
Source§impl NsupdateExecutor
impl NsupdateExecutor
Sourcepub fn new(
server: String,
port: u16,
tsig_key_name: Option<String>,
tsig_algorithm: Option<String>,
tsig_secret: Option<String>,
) -> Result<Self>
pub fn new( server: String, port: u16, tsig_key_name: Option<String>, tsig_algorithm: Option<String>, tsig_secret: Option<String>, ) -> Result<Self>
Create a new nsupdate executor
§Arguments
server- DNS server address (e.g., “127.0.0.1”)port- DNS server port (typically 53)tsig_key_name- Optional TSIG key nametsig_algorithm- Optional TSIG algorithmtsig_secret- Optional TSIG secret (base64-encoded)
§Example
ⓘ
use bindcar::nsupdate::NsupdateExecutor;
let executor = NsupdateExecutor::new(
"127.0.0.1".to_string(),
53,
Some("update-key".to_string()),
Some("HMAC-SHA256".to_string()),
Some("dGVzdC1zZWNyZXQ=".to_string()),
)?;Sourcepub async fn add_record(
&self,
zone: &str,
name: &str,
ttl: u32,
record_type: &str,
value: &str,
) -> Result<String>
pub async fn add_record( &self, zone: &str, name: &str, ttl: u32, record_type: &str, value: &str, ) -> Result<String>
Add a DNS record
§Arguments
zone- Zone name (e.g., “example.com”)name- Record name (FQDN, e.g., “www.example.com.”)ttl- Time-to-live in secondsrecord_type- Record type (e.g., “A”, “AAAA”, “CNAME”)value- Record value (e.g., “192.0.2.1”)
§Example
ⓘ
executor.add_record(
"example.com",
"www.example.com.",
3600,
"A",
"192.0.2.1"
).await?;Sourcepub async fn remove_record(
&self,
zone: &str,
name: &str,
record_type: &str,
value: &str,
) -> Result<String>
pub async fn remove_record( &self, zone: &str, name: &str, record_type: &str, value: &str, ) -> Result<String>
Remove a DNS record
§Arguments
zone- Zone name (e.g., “example.com”)name- Record name (FQDN, e.g., “www.example.com.”)record_type- Record type (e.g., “A”)value- Record value to remove (e.g., “192.0.2.1”). If empty, removes all records of this type.
§Example
ⓘ
// Remove specific record
executor.remove_record(
"example.com",
"www.example.com.",
"A",
"192.0.2.1"
).await?;
// Remove all A records for www
executor.remove_record(
"example.com",
"www.example.com.",
"A",
""
).await?;Sourcepub async fn update_record(
&self,
zone: &str,
name: &str,
ttl: u32,
record_type: &str,
old_value: &str,
new_value: &str,
) -> Result<String>
pub async fn update_record( &self, zone: &str, name: &str, ttl: u32, record_type: &str, old_value: &str, new_value: &str, ) -> Result<String>
Update a DNS record (atomic delete + add)
§Arguments
zone- Zone name (e.g., “example.com”)name- Record name (FQDN, e.g., “www.example.com.”)ttl- New time-to-live in secondsrecord_type- Record type (e.g., “A”)old_value- Current record value (e.g., “192.0.2.1”)new_value- New record value (e.g., “192.0.2.2”)
§Example
ⓘ
executor.update_record(
"example.com",
"www.example.com.",
3600,
"A",
"192.0.2.1",
"192.0.2.2"
).await?;Trait Implementations§
Source§impl Clone for NsupdateExecutor
impl Clone for NsupdateExecutor
Source§fn clone(&self) -> NsupdateExecutor
fn clone(&self) -> NsupdateExecutor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NsupdateExecutor
impl RefUnwindSafe for NsupdateExecutor
impl Send for NsupdateExecutor
impl Sync for NsupdateExecutor
impl Unpin for NsupdateExecutor
impl UnwindSafe for NsupdateExecutor
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].