1mod http;
2pub mod errors;
3
4
5#[cfg(feature = "dnsimple")]
6pub mod dnsimple;
7#[cfg(feature = "gandi")]
8pub mod gandi;
9
10use std::{fmt::{self, Debug, Display, Formatter}, net::Ipv4Addr};
11
12use serde::{Deserialize, Serialize};
13
14use crate::errors::Result;
15
16
17pub struct Config {
18 pub domain: String,
19 pub dry_run: bool,
20}
21
22#[derive(Serialize, Deserialize, Clone, Debug)]
23pub enum RecordType {
24 A,
25 AAAA,
26 CAA,
27 CNAME,
28 HINFO,
29 MX,
30 NAPTR,
31 NS,
32 PTR,
33 SRV,
34 SPF,
35 SSHFP,
36 TXT,
37}
38
39impl Display for RecordType {
40 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
41 write!(f, "{:?}", self)
42 }
43}
44
45#[allow(unused)]
46#[trait_variant::make(Send)]
47pub trait DnsProvider {
48 async fn get_v4_record(&self, host: &str) -> Result<Option<Ipv4Addr>>;
49 async fn create_v4_record(&self, host: &str, ip: &Ipv4Addr) -> Result<()>;
50 async fn update_v4_record(&self, host: &str, ip: &Ipv4Addr) -> Result<()>;
51 async fn delete_v4_record(&self, host: &str) -> Result<()>;
52}