technitium 0.4.0

Typed async Rust client for the Technitium DNS Server API
Documentation
use serde::Deserialize;
use std::net::IpAddr;

/// A DHCP scope managed by the server.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DhcpScope {
    /// The scope name.
    pub name: Option<String>,
    /// Whether the scope is enabled.
    #[serde(default)]
    pub enabled: bool,
    /// All other fields.
    #[serde(flatten)]
    pub extra: serde_json::Value,
}

/// A DHCP lease.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DhcpLease {
    /// The leased IP address.
    pub ip_address: Option<IpAddr>,
    /// The client hostname.
    pub host_name: Option<String>,
    /// The client MAC address.
    pub hardware_address: Option<String>,
    /// All other fields.
    #[serde(flatten)]
    pub extra: serde_json::Value,
}

/// Response wrapper for scope listing.
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct DhcpScopeListResponse {
    pub scopes: Vec<DhcpScope>,
}

/// Response wrapper for lease listing.
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct DhcpLeaseListResponse {
    pub leases: Vec<DhcpLease>,
}