aboutsummaryrefslogtreecommitdiffstats
path: root/src/access/bans.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-07 22:35:21 +0100
committertv <tv@krebsco.de>2026-11-07 22:35:21 +0100
commit22d3e8148d30887041a030b93b3e6de3f749a6cd (patch)
tree27ed95306d078d70e1fd6cf90bbd4482aced1a4a /src/access/bans.rs
parente12bf8355d4b8318f70dbc964f2c1d3b57b4a038 (diff)
access: bans
_continuum/banned/<node ID>: every node refuses the banned node's changes from then on (judged as the ban stood) and leaves its handshakes unanswered. Auth plan M6.
Diffstat (limited to 'src/access/bans.rs')
-rw-r--r--src/access/bans.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/access/bans.rs b/src/access/bans.rs
new file mode 100644
index 0000000..339f6cf
--- /dev/null
+++ b/src/access/bans.rs
@@ -0,0 +1,18 @@
+//! Banned nodes (`_continuum/banned/<node ID>`, `{"by", "at", "reason"}`), written by a
+//! user who may write there, as any protocol data: a node refuses a banned node's
+//! handshake, so it neither syncs with it nor counts it a member (`swarm::peer`), and
+//! with the swarm's policy every node refuses the changes a banned node commits
+//! (`access::rules`, judged as the ban stood when they were made). Deleting the entry
+//! lifts the ban.
+
+use crate::document::{ReadDoc, meta, store};
+
+/// Where `node`'s ban is.
+pub(crate) fn path(node: &str) -> Vec<String> {
+ meta::path(&[meta::BANNED, node])
+}
+
+/// Whether `doc` bans `node`.
+pub(crate) fn banned(doc: &impl ReadDoc, node: &str) -> bool {
+ store::read_path(doc, &path(node)).ok().flatten().is_some()
+}