aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-04-05 16:02:32 +0200
committerAlex Auvolat <alex@adnab.me>2023-04-05 16:02:32 +0200
commitd906a6ebb5d977f44340b157a520477849ced161 (patch)
treeca3504173703ae93854a137c15aa6b9490912ebd
parent0ed9edefee75a99fe3f662257a4009e0f9b6e55a (diff)
downloadD53-d906a6ebb5d977f44340b157a520477849ced161.tar.gz
D53-d906a6ebb5d977f44340b157a520477849ced161.zip
refactoring
-rw-r--r--src/dns_config.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/dns_config.rs b/src/dns_config.rs
index 9eb6075..8e82c32 100644
--- a/src/dns_config.rs
+++ b/src/dns_config.rs
@@ -138,26 +138,23 @@ impl DnsConfigFetcher {
return Ok(None);
}
- let (record_type, targets) = match splits[0] {
+ let (record_type, target) = match splits[0] {
"d53-a" => match self.get_node_ipv4(&node).await? {
- Some(tgt) => (DnsRecordType::A, [tgt.to_string()].into_iter().collect()),
+ Some(tgt) => (DnsRecordType::A, tgt.to_string()),
None => {
warn!("Got d53-a tag `{}` but node {} does not appear to have a known public IPv4 address. Tag is ignored.", tag, node.node);
return Ok(None);
}
},
"d53-aaaa" => match self.get_node_ipv6(&node).await? {
- Some(tgt) => (DnsRecordType::AAAA, [tgt.to_string()].into_iter().collect()),
+ Some(tgt) => (DnsRecordType::AAAA, tgt.to_string()),
None => {
warn!("Got d53-aaaa tag `{}` but node {} does not appear to have a known public IPv6 address. Tag is ignored.", tag, node.node);
return Ok(None);
}
},
"d53-cname" => match node.meta.get(CNAME_TARGET_METADATA_TAG) {
- Some(tgt) => (
- DnsRecordType::CNAME,
- [tgt.to_string()].into_iter().collect(),
- ),
+ Some(tgt) => (DnsRecordType::CNAME, tgt.to_string()),
None => {
warn!("Got d53-cname tag `{}` but node {} does not have a {} metadata value. Tag is ignored.", tag, node.node, CNAME_TARGET_METADATA_TAG);
return Ok(None);
@@ -171,7 +168,9 @@ impl DnsConfigFetcher {
dns_path: splits[1].to_string(),
record_type,
},
- DnsEntryValue { targets },
+ DnsEntryValue {
+ targets: [target].into_iter().collect(),
+ },
)))
}