Skip to content

Commit

Permalink
v0.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Mar 28, 2024
1 parent 8be9cb4 commit 29b47c7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
mail-auth 0.3.10
================================
- Make `Resolver` cloneable.

mail-auth 0.3.9
================================
- Use relaxed parsing for DNS names (#25)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "mail-auth"
description = "DKIM, ARC, SPF and DMARC library for Rust"
version = "0.3.9"
version = "0.3.10"
edition = "2021"
authors = [ "Stalwart Labs <hello@stalw.art>"]
license = "Apache-2.0 OR MIT"
Expand Down
16 changes: 15 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ use hickory_resolver::{
TokioAsyncResolver,
};
use mta_sts::{MtaSts, TlsRpt};
use parking_lot::Mutex;
use spf::{Macro, Spf};

pub mod arc;
Expand Down Expand Up @@ -604,7 +605,7 @@ impl Default for SpfOutput {
}
}

thread_local!(static COUNTER: Cell<u64> = Cell::new(0));
thread_local!(static COUNTER: Cell<u64> = const { Cell::new(0) });

/// Generates a random value between 0 and 100.
/// Returns true if the generated value is within the requested
Expand All @@ -621,3 +622,16 @@ pub(crate) fn is_within_pct(pct: u8) -> bool {
}) % 100
< pct as u64
}

impl Clone for Resolver {
fn clone(&self) -> Self {
Self {
resolver: self.resolver.clone(),
cache_txt: Mutex::new(self.cache_txt.lock().clone()),
cache_mx: Mutex::new(self.cache_mx.lock().clone()),
cache_ipv4: Mutex::new(self.cache_ipv4.lock().clone()),
cache_ipv6: Mutex::new(self.cache_ipv6.lock().clone()),
cache_ptr: Mutex::new(self.cache_ptr.lock().clone()),
}
}
}

0 comments on commit 29b47c7

Please sign in to comment.