pub struct Blocklist { /* private fields */ }Expand description
File-backed per-peer block-list. Maps a DID → entry. Absence = not blocked.
Implementations§
Source§impl Blocklist
impl Blocklist
Sourcepub fn load() -> Self
pub fn load() -> Self
Load from config/wire/blocklist.json. Missing → empty. Malformed →
empty + a warning (fail-safe: never wedge, never silently lose a real
block without saying so).
Sourcepub fn block(&mut self, did: &str, note: Option<String>) -> bool
pub fn block(&mut self, did: &str, note: Option<String>) -> bool
Block a DID (idempotent: re-blocking refreshes the note, keeps at).
Returns true if this is a newly-added block, false if already present.
Sourcepub fn unblock(&mut self, did: &str) -> bool
pub fn unblock(&mut self, did: &str) -> bool
Remove a DID from the block-list. Returns true if it was present.
Sourcepub fn is_blocked(&self, did: &str) -> bool
pub fn is_blocked(&self, did: &str) -> bool
Is this exact DID blocked?
Sourcepub fn blocks_card<'c>(&self, card: &'c AgentCard) -> Option<&'c str>
pub fn blocks_card<'c>(&self, card: &'c AgentCard) -> Option<&'c str>
Does this card belong to a blocked peer? Checks both the session DID and
the operator DID (op_did) the card carries, so blocking an operator
cuts off all of their sessions. Returns the matched DID for diagnostics.
Sourcepub fn entries(&self) -> impl Iterator<Item = (&String, &BlockEntry)>
pub fn entries(&self) -> impl Iterator<Item = (&String, &BlockEntry)>
Iterate entries (sorted by DID via the BTreeMap), for wire blocked.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Blocklist
impl RefUnwindSafe for Blocklist
impl Send for Blocklist
impl Sync for Blocklist
impl Unpin for Blocklist
impl UnsafeUnpin for Blocklist
impl UnwindSafe for Blocklist
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more