From 6085ba0cc2159a5305455f8cb3e7161f7e04134f Mon Sep 17 00:00:00 2001 From: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> Date: Mon, 16 Mar 2026 09:02:10 +0200 Subject: [PATCH 1/4] Add Host header to fetch_trace_ip function --- src/provider.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/provider.rs b/src/provider.rs index 16577f0..d4925af 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -167,6 +167,7 @@ pub fn parse_trace_ip(body: &str) -> Option { async fn fetch_trace_ip(client: &Client, url: &str, timeout: Duration) -> Option { let resp = client .get(url) + .header("Host", "one.one.one.one") .timeout(timeout) .send() .await From 36bdbea5685726209d42b1f238b7f1c83b4b92f4 Mon Sep 17 00:00:00 2001 From: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> Date: Mon, 16 Mar 2026 20:28:26 +0200 Subject: [PATCH 2/4] Deduplicate IPs before DNS record update Remove duplicate IPs before updating DNS records to ensure stable input. --- src/updater.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/updater.rs b/src/updater.rs index ae260dd..e4a4b36 100644 --- a/src/updater.rs +++ b/src/updater.rs @@ -65,8 +65,11 @@ pub async fn update_once( } // Update DNS records (env var mode - domain-based) - for (ip_type, domains) in &config.domains { - let ips = detected_ips.get(ip_type).cloned().unwrap_or_default(); + for (ip_type, domains) in &config.domains { + let mut ips = detected_ips.get(ip_type).cloned().unwrap_or_default(); + // FIX: remove duplicates so CloudflareHandle::set_ips sees stable input + ips.sort(); + ips.dedup(); let record_type = ip_type.record_type(); for domain_str in domains { From 3d796d470ce02d643cec4ec4644ae033557c9771 Mon Sep 17 00:00:00 2001 From: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> Date: Tue, 17 Mar 2026 10:04:20 +0200 Subject: [PATCH 3/4] Deduplicate IPs before DNS record update Remove duplicate IPs before updating DNS records to ensure stable input. Signed-off-by: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> --- src/updater.rs | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/updater.rs b/src/updater.rs index ae260dd..8c058e3 100644 --- a/src/updater.rs +++ b/src/updater.rs @@ -24,6 +24,7 @@ pub async fn update_once( let mut all_ok = true; let mut messages = Vec::new(); + let mut notify = false; // NEW: track meaningful events if config.legacy_mode { all_ok = update_legacy(config, ppfmt).await; @@ -65,8 +66,11 @@ pub async fn update_once( } // Update DNS records (env var mode - domain-based) - for (ip_type, domains) in &config.domains { - let ips = detected_ips.get(ip_type).cloned().unwrap_or_default(); + for (ip_type, domains) in &config.domains { + let mut ips = detected_ips.get(ip_type).cloned().unwrap_or_default(); + // FIX: remove duplicates so CloudflareHandle::set_ips sees stable input + ips.sort(); + ips.dedup(); let record_type = ip_type.record_type(); for domain_str in domains { @@ -108,6 +112,7 @@ pub async fn update_once( match result { SetResult::Updated => { + notify = true; // NEW let ip_strs: Vec = ips.iter().map(|ip| ip.to_string()).collect(); messages.push(Message::new_ok(&format!( "Updated {domain_str} -> {}", @@ -115,6 +120,7 @@ pub async fn update_once( ))); } SetResult::Failed => { + notify = true; // NEW all_ok = false; messages.push(Message::new_fail(&format!( "Failed to update {domain_str}" @@ -147,12 +153,14 @@ pub async fn update_once( match result { SetResult::Updated => { + notify = true; // NEW messages.push(Message::new_ok(&format!( "Updated WAF list {}", waf_list.describe() ))); } SetResult::Failed => { + notify = true; // NEW all_ok = false; messages.push(Message::new_fail(&format!( "Failed to update WAF list {}", @@ -164,13 +172,17 @@ pub async fn update_once( } } - // Send heartbeat - let heartbeat_msg = Message::merge(messages.clone()); - heartbeat.ping(&heartbeat_msg).await; + // Send heartbeat ONLY if something meaningful happened + if notify { + let heartbeat_msg = Message::merge(messages.clone()); + heartbeat.ping(&heartbeat_msg).await; + } - // Send notifications - let notifier_msg = Message::merge(messages); - notifier.send(¬ifier_msg).await; + // Send notifications ONLY when IP changed or failed + if notify { + let notifier_msg = Message::merge(messages); + notifier.send(¬ifier_msg).await; + } all_ok } From 8a4b57c163ffc267eed4b682e2cf460790e4713b Mon Sep 17 00:00:00 2001 From: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> Date: Tue, 17 Mar 2026 10:10:00 +0200 Subject: [PATCH 4/4] undo FIX: remove duplicates so CloudflareHandle::set_ips sees stable input Signed-off-by: DaRK AnGeL <28630321+masterwishx@users.noreply.github.com> --- src/updater.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/updater.rs b/src/updater.rs index 8c058e3..f9bd2e9 100644 --- a/src/updater.rs +++ b/src/updater.rs @@ -66,11 +66,8 @@ pub async fn update_once( } // Update DNS records (env var mode - domain-based) - for (ip_type, domains) in &config.domains { - let mut ips = detected_ips.get(ip_type).cloned().unwrap_or_default(); - // FIX: remove duplicates so CloudflareHandle::set_ips sees stable input - ips.sort(); - ips.dedup(); + for (ip_type, domains) in &config.domains { + let ips = detected_ips.get(ip_type).cloned().unwrap_or_default(); let record_type = ip_type.record_type(); for domain_str in domains {