Commit
Author: mdecimus [mauro@stalw.art]
Hash: 29b47c7e0b95a6f64eb5fe4c0ee616229d29fbdf
Timestamp: Thu, 28 Mar 2024 14:51:24 +0000 (7 months ago)

+20 -2 +/-3 browse
v0.3.10
1diff --git a/CHANGELOG.md b/CHANGELOG.md
2index cfdb694..5bfb8aa 100644
3--- a/CHANGELOG.md
4+++ b/CHANGELOG.md
5 @@ -1,3 +1,7 @@
6+ mail-auth 0.3.10
7+ ================================
8+ - Make `Resolver` cloneable.
9+
10 mail-auth 0.3.9
11 ================================
12 - Use relaxed parsing for DNS names (#25)
13 diff --git a/Cargo.toml b/Cargo.toml
14index ddb4948..c916180 100644
15--- a/Cargo.toml
16+++ b/Cargo.toml
17 @@ -1,7 +1,7 @@
18 [package]
19 name = "mail-auth"
20 description = "DKIM, ARC, SPF and DMARC library for Rust"
21- version = "0.3.9"
22+ version = "0.3.10"
23 edition = "2021"
24 authors = [ "Stalwart Labs <hello@stalw.art>"]
25 license = "Apache-2.0 OR MIT"
26 diff --git a/src/lib.rs b/src/lib.rs
27index 966d50e..67d3c91 100644
28--- a/src/lib.rs
29+++ b/src/lib.rs
30 @@ -275,6 +275,7 @@ use hickory_resolver::{
31 TokioAsyncResolver,
32 };
33 use mta_sts::{MtaSts, TlsRpt};
34+ use parking_lot::Mutex;
35 use spf::{Macro, Spf};
36
37 pub mod arc;
38 @@ -604,7 +605,7 @@ impl Default for SpfOutput {
39 }
40 }
41
42- thread_local!(static COUNTER: Cell<u64> = Cell::new(0));
43+ thread_local!(static COUNTER: Cell<u64> = const { Cell::new(0) });
44
45 /// Generates a random value between 0 and 100.
46 /// Returns true if the generated value is within the requested
47 @@ -621,3 +622,16 @@ pub(crate) fn is_within_pct(pct: u8) -> bool {
48 }) % 100
49 < pct as u64
50 }
51+
52+ impl Clone for Resolver {
53+ fn clone(&self) -> Self {
54+ Self {
55+ resolver: self.resolver.clone(),
56+ cache_txt: Mutex::new(self.cache_txt.lock().clone()),
57+ cache_mx: Mutex::new(self.cache_mx.lock().clone()),
58+ cache_ipv4: Mutex::new(self.cache_ipv4.lock().clone()),
59+ cache_ipv6: Mutex::new(self.cache_ipv6.lock().clone()),
60+ cache_ptr: Mutex::new(self.cache_ptr.lock().clone()),
61+ }
62+ }
63+ }