aboutsummaryrefslogtreecommitdiff
path: root/src/provider/mod.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-07 15:35:12 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-07 16:09:38 +0100
commited2653ae7dba9c072dcca1aed03b7cda0d910c85 (patch)
tree84452e729d4dbe8c27e3b7b7d4b3160833cfa40e /src/provider/mod.rs
downloadD53-ed2653ae7dba9c072dcca1aed03b7cda0d910c85.tar.gz
D53-ed2653ae7dba9c072dcca1aed03b7cda0d910c85.zip
First version of D53 that does something
First working version
Diffstat (limited to 'src/provider/mod.rs')
-rw-r--r--src/provider/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/provider/mod.rs b/src/provider/mod.rs
new file mode 100644
index 0000000..6527631
--- /dev/null
+++ b/src/provider/mod.rs
@@ -0,0 +1,20 @@
+pub mod gandi;
+
+use std::net::{Ipv4Addr, Ipv6Addr};
+
+use anyhow::Result;
+use async_trait::async_trait;
+
+#[async_trait]
+pub trait DnsProvider: Send + Sync {
+ fn provider(&self) -> &'static str;
+ async fn update_a(&self, domain: &str, subdomain: &str, targets: &[Ipv4Addr]) -> Result<()>;
+ async fn update_aaaa(&self, domain: &str, subdomain: &str, targets: &[Ipv6Addr]) -> Result<()>;
+ async fn update_cname(&self, domain: &str, subdomain: &str, target: &str) -> Result<()>;
+}
+
+impl std::fmt::Debug for dyn DnsProvider {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
+ write!(f, "DnsProvider({})", self.provider())
+ }
+}