diff --git a/cloudflare/src/endpoints/dns.rs b/cloudflare/src/endpoints/dns.rs index 871945ff..164b09e4 100644 --- a/cloudflare/src/endpoints/dns.rs +++ b/cloudflare/src/endpoints/dns.rs @@ -7,7 +7,7 @@ use crate::framework::{OrderDirection, SearchMatch}; use chrono::offset::Utc; use chrono::DateTime; use serde::{Deserialize, Serialize}; -use std::net::{Ipv4Addr, Ipv6Addr}; +use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; /// List DNS Records /// @@ -174,6 +174,15 @@ pub enum DnsContent { SRV { content: String }, } +impl> From for DnsContent { + fn from(value: T) -> Self { + match value.into() { + IpAddr::V4(content) => Self::A { content }, + IpAddr::V6(content) => Self::AAAA { content }, + } + } +} + #[derive(Deserialize, Debug)] pub struct DeleteDnsRecordResponse { /// DNS record identifier tag