Parcourir la source

If positive reports change anything, print a notice

Vecna il y a 4 mois
Parent
commit
7acba0a6f0
1 fichiers modifiés avec 20 ajouts et 0 suppressions
  1. 20 0
      src/analysis.rs

+ 20 - 0
src/analysis.rs

@@ -8,6 +8,9 @@ use std::{
     collections::{BTreeMap, HashSet},
 };
 
+#[cfg(feature = "simulation")]
+use crate::get_date;
+
 /// Provides a function for predicting which countries block this bridge
 pub trait Analyzer {
     /// Evaluate open-entry bridge. Returns true if blocked, false otherwise.
@@ -159,6 +162,23 @@ pub fn blocked_in(
                     positive_reports_today,
                 ) {
                     blocked_in.insert(country.to_string());
+                } else {
+                    // Logging in simulation mode
+                    #[cfg(feature = "simulation")]
+                    if analyzer.stage_two(
+                        age,
+                        confidence,
+                        &bridge_ips,
+                        bridge_ips_today,
+                        &negative_reports,
+                        negative_reports_today,
+                    ) {
+                        println!(
+                            "{} detected not blocked due to positive reports on day {}",
+                            array_bytes::bytes2hex("", bridge_info.fingerprint),
+                            get_date()
+                        );
+                    }
                 }
             }
         }