projects
/
gandi_dns_update.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Display the hostname when renewing.
[gandi_dns_update.git]
/
src
/
main.rs
diff --git
a/src/main.rs
b/src/main.rs
index
496fd98
..
4b0d196
100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-30,7
+30,7
@@
fn main() -> Result<()> {
loop {
let time_beginning_loop = time::Instant::now();
loop {
let time_beginning_loop = time::Instant::now();
- if let Err(err) = check_and_update_dns(&config.api_key, &config.
fqdn, &config.
domains, config.ttl) {
+ if let Err(err) = check_and_update_dns(&config.api_key, &config.domains, config.ttl) {
println!("!! {}", err);
}
println!("!! {}", err);
}
@@
-43,16
+43,16
@@
fn main() -> Result<()> {
}
}
}
}
-fn check_and_update_dns(api_key: &str,
fqdn: &str, domains: &Vec<String
>, ttl: i32) -> Result<()> {
+fn check_and_update_dns(api_key: &str,
domains: &Vec<(String, String)
>, ttl: i32) -> Result<()> {
let real_ip = get_real_ip()?;
let real_ip = get_real_ip()?;
- for
domain
in domains {
- let current_ip = get_current_record_ip(api_key,
domain, fqd
n)?;
+ for
(hostname, domain)
in domains {
+ let current_ip = get_current_record_ip(api_key,
hostname, domai
n)?;
if real_ip != current_ip {
println!("IP addresses don't match for domain {}: real = {}, dns = {}. Renewing DNS...", domain, real_ip, current_ip);
if real_ip != current_ip {
println!("IP addresses don't match for domain {}: real = {}, dns = {}. Renewing DNS...", domain, real_ip, current_ip);
- update_record_ip(api_key,
domain, fqd
n, real_ip, ttl)?;
- println!("Renewing of {}
successfully"
, domain);
+ update_record_ip(api_key,
hostname, domai
n, real_ip, ttl)?;
+ println!("Renewing of {}
.{} successfully", hostname
, domain);
}
}
}
}