rs_dapi_client/address_ban_info.rs
1//! An owned snapshot of an address' ban state, decoupled from the
2//! lock-guarded [`crate::AddressList`] internals so it can cross crate
3//! and FFI boundaries.
4
5use chrono::{DateTime, Utc};
6
7/// An owned, cloned snapshot of a single address' ban state, returned
8/// from [`crate::AddressList::ban_info`].
9///
10/// This is a plain-data mirror of [`crate::AddressStatus`] (plus the
11/// address URI) so it can be handed across crate / FFI boundaries
12/// without holding the [`crate::AddressList`] lock.
13#[derive(Debug, Clone)]
14pub struct AddressBanInfo {
15 /// The address URI as a string.
16 pub uri: String,
17 /// Whether the address is *currently effectively* banned, i.e. it
18 /// has been banned at least once and the ban period has not yet
19 /// expired. Consistent with the filtering used by
20 /// [`crate::AddressList::get_live_address`].
21 pub banned: bool,
22 /// Total number of times the address has been banned (drives the
23 /// exponential backoff).
24 pub ban_count: usize,
25 /// The timestamp until which the address remains banned, if any.
26 pub banned_until: Option<DateTime<Utc>>,
27 /// Human-readable reason for the most recent ban, if recorded.
28 pub reason: Option<String>,
29}