Commits vergleichen
2 Commits
b8d49d91ba
...
767050dc03
Autor | SHA1 | Datum | |
---|---|---|---|
767050dc03 | |||
e77d757bfd |
5 geänderte Dateien mit 8 neuen und 69 gelöschten Zeilen
8
Cargo.lock
generiert
8
Cargo.lock
generiert
|
@ -1779,9 +1779,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "schemars"
|
name = "schemars"
|
||||||
version = "0.9.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f"
|
checksum = "fe8c9d1c68d67dd9f97ecbc6f932b60eb289c5dbddd8aa1405484a8fd2fcd984"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dyn-clone",
|
"dyn-clone",
|
||||||
"ref-cast",
|
"ref-cast",
|
||||||
|
@ -1792,9 +1792,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "schemars_derive"
|
name = "schemars_derive"
|
||||||
version = "0.9.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5016d94c77c6d32f0b8e08b781f7dc8a90c2007d4e77472cc2807bc10a8438fe"
|
checksum = "6ca9fcb757952f8e8629b9ab066fc62da523c46c2b247b1708a3be06dd82530b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -56,7 +56,7 @@ version = "0.12"
|
||||||
[dependencies.schemars]
|
[dependencies.schemars]
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["derive", "std", "preserve_order"]
|
features = ["derive", "std", "preserve_order"]
|
||||||
version = "0.9.0"
|
version = "1.0.1"
|
||||||
|
|
||||||
[dependencies.serde]
|
[dependencies.serde]
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
use macro_rules_attribute::apply;
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
macros::{
|
|
||||||
ConfigFile,
|
|
||||||
DefDer,
|
|
||||||
},
|
|
||||||
types::{
|
|
||||||
self,
|
|
||||||
dns::Dns,
|
|
||||||
structs::DnsToken,
|
|
||||||
traits::DnsHandler,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
#[apply(DefDer)]
|
|
||||||
#[apply(ConfigFile)]
|
|
||||||
#[serde(deny_unknown_fields)]
|
|
||||||
pub struct DNSUpdateClientOptions {}
|
|
||||||
|
|
||||||
impl DNSUpdateClientOptions {
|
|
||||||
pub fn build(self, _zone: String) -> Dns {
|
|
||||||
Dns::DNSUpdate(DnsUpdateHandler {})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[apply(DefDer)]
|
|
||||||
pub struct DnsUpdateHandler {}
|
|
||||||
|
|
||||||
impl DnsHandler for DnsUpdateHandler {
|
|
||||||
async fn set_record(&self, _domain: String, _content: String) -> types::Result<DnsToken> {
|
|
||||||
Ok(DnsToken::new_dns_update())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[apply(DefDer)]
|
|
||||||
pub struct DnsUpdateToken {}
|
|
||||||
|
|
||||||
impl DnsUpdateToken {
|
|
||||||
pub async fn remove(&mut self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl Send for DnsUpdateToken {}
|
|
|
@ -1,4 +1,3 @@
|
||||||
pub(super) mod dnsupdate;
|
|
||||||
pub(super) mod pdns;
|
pub(super) mod pdns;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -8,16 +7,10 @@ use crate::{
|
||||||
},
|
},
|
||||||
types::{
|
types::{
|
||||||
self,
|
self,
|
||||||
dns::{
|
dns::pdns::{
|
||||||
dnsupdate::{
|
|
||||||
DNSUpdateClientOptions,
|
|
||||||
DnsUpdateHandler,
|
|
||||||
},
|
|
||||||
pdns::{
|
|
||||||
PdnsClientOptions,
|
PdnsClientOptions,
|
||||||
PdnsHandler,
|
PdnsHandler,
|
||||||
},
|
},
|
||||||
},
|
|
||||||
structs::{
|
structs::{
|
||||||
DnsToken,
|
DnsToken,
|
||||||
Error,
|
Error,
|
||||||
|
@ -86,7 +79,6 @@ impl Manager {
|
||||||
fixed_zone,
|
fixed_zone,
|
||||||
match builder {
|
match builder {
|
||||||
Builder::PowerDNS(pdns_client_options) => pdns_client_options.build(zone, self.1.clone()),
|
Builder::PowerDNS(pdns_client_options) => pdns_client_options.build(zone, self.1.clone()),
|
||||||
Builder::DNSUpdate(dnsupdate_client_options) => dnsupdate_client_options.build(zone),
|
|
||||||
Builder::None => Dns::None,
|
Builder::None => Dns::None,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -108,7 +100,6 @@ struct InnerManager {
|
||||||
#[serde(tag = "type", rename_all = "lowercase")]
|
#[serde(tag = "type", rename_all = "lowercase")]
|
||||||
pub enum Builder {
|
pub enum Builder {
|
||||||
PowerDNS(PdnsClientOptions),
|
PowerDNS(PdnsClientOptions),
|
||||||
DNSUpdate(DNSUpdateClientOptions),
|
|
||||||
#[default]
|
#[default]
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
@ -116,7 +107,6 @@ pub enum Builder {
|
||||||
#[apply(DefDer)]
|
#[apply(DefDer)]
|
||||||
pub enum Dns {
|
pub enum Dns {
|
||||||
PowerDNS(PdnsHandler),
|
PowerDNS(PdnsHandler),
|
||||||
DNSUpdate(DnsUpdateHandler),
|
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +114,6 @@ impl Dns {
|
||||||
pub async fn set_record(&self, domain: String, content: String) -> types::Result<DnsToken> {
|
pub async fn set_record(&self, domain: String, content: String) -> types::Result<DnsToken> {
|
||||||
match self {
|
match self {
|
||||||
Dns::PowerDNS(pdns_handler) => pdns_handler.set_record(domain, content).await,
|
Dns::PowerDNS(pdns_handler) => pdns_handler.set_record(domain, content).await,
|
||||||
Dns::DNSUpdate(dns_update_handler) => dns_update_handler.set_record(domain, content).await,
|
|
||||||
Dns::None => Error::err("Not Implemented"),
|
Dns::None => Error::err("Not Implemented"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ use crate::{
|
||||||
},
|
},
|
||||||
dns::{
|
dns::{
|
||||||
Manager,
|
Manager,
|
||||||
dnsupdate::DnsUpdateToken,
|
|
||||||
pdns::PdnsToken,
|
pdns::PdnsToken,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -168,7 +167,6 @@ impl Error {
|
||||||
pub enum DnsToken {
|
pub enum DnsToken {
|
||||||
None,
|
None,
|
||||||
Pdns(Box<PdnsToken>),
|
Pdns(Box<PdnsToken>),
|
||||||
DnsUpdate(DnsUpdateToken),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DnsToken {
|
impl DnsToken {
|
||||||
|
@ -176,10 +174,6 @@ impl DnsToken {
|
||||||
Self::Pdns(Box::new(PdnsToken::new(builder)))
|
Self::Pdns(Box::new(PdnsToken::new(builder)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_dns_update() -> Self {
|
|
||||||
Self::DnsUpdate(DnsUpdateToken {})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn new_none() -> Self {
|
pub fn new_none() -> Self {
|
||||||
Self::None
|
Self::None
|
||||||
}
|
}
|
||||||
|
@ -188,7 +182,6 @@ impl DnsToken {
|
||||||
match self {
|
match self {
|
||||||
DnsToken::None => {},
|
DnsToken::None => {},
|
||||||
DnsToken::Pdns(pdns_token) => pdns_token.remove().await,
|
DnsToken::Pdns(pdns_token) => pdns_token.remove().await,
|
||||||
DnsToken::DnsUpdate(dns_update_token) => dns_update_token.remove().await,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Laden …
Tabelle hinzufügen
In neuem Issue referenzieren