#![cfg_attr(debug_assertions, allow(unused_variables, unused_imports, dead_code))]
-use std::{ fmt::format, fs::File, net::{ IpAddr, Ipv4Addr }, thread, time };
+use std::{ fs::File, net::{ IpAddr, Ipv4Addr }, thread, time };
use ron::{ de::from_reader, ser::to_writer };
use serde::{ Deserialize, Serialize };
use serde_json::{ Value, json };
fn check_and_update_dns(api_key: &str, fqdn: &str, domains: &Vec<String>, ttl: i32) -> Result<()> {
let real_ip = get_real_ip()?;
- dbg!(&real_ip);
for domain in domains {
let current_ip = get_current_record_ip(api_key, domain, fqdn)?;
- dbg!(domain, current_ip);
if real_ip != current_ip {
println!("IP addresses don't match for domain {}: real = {}, dns = {}. Renewing DNS...", domain, real_ip, current_ip);
let json_value = request_livedns_gandi(api_key, &format!("domains/{}/records/{}/A", fqdn, name), Method::Put(json_body.to_string()))?;
- dbg!(json_value);
+ println!("Update response: {}", json_value);
Ok(())
}