Support for loading IP addresses from DiploNAT autodiscovery #4
1 changed files with 7 additions and 8 deletions
|
@ -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(),
|
||||
},
|
||||
)))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue