Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_net/src/lens/mod.rs

2.6 KiB, 9 runs

created by r1870400018:65640, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1//! The generic half of a debug lens: a gated NDJSON sink, the row envelope and a redactor.
2//!
3//! Lifted from Daimond, where the same pieces were written for one gateway. `sink::Sink` is the
4//! gates of `gateway/src/handlers/debug_trace.rs` (body, row and field caps, a per-key rate
5//! floor, rotation by size, history by age, count and total bytes) writing one JSON object a
6//! line. `row::Row` is the event envelope `{v, d, n, b, t}` of `www/js/debugshare.js`, and
7//! `redact::Redact` is its `SECRET_RE` and `fingerprint` over a `Dat`, with hooks for a caller's
8//! deny-list and a caller's string test. Nothing here knows an application: an app supplies the
9//! rows, the keys and the redaction hooks, and `Sink::new` is all it needs of the file system.
10//!
11//! The envelope and the gates must stay equal to Daimond's, so that Daimond's gateway can move
12//! onto this module without its clients or its reader noticing. `Gates::daimond` holds Daimond's
13//! numbers; `Gates::default` holds the retention the test site wants instead.
14//!
15//! `shot::Shots` is the picture half: a device asked for a picture of its screen answers with a
16//! PNG or a reason, under a rate floor, a size cap and an age of seven days.
17//!
18//! With the `async` feature, `tap::Tap` is a tap on a websocket's messages (`crate::ws::tap`)
19//! that files what a caller's filter keeps as rows of a `Sink`.
20//!
21//! Two pieces serve an app's own secrets. `redact::Phrase` is the test for a passphrase drawn from
22//! a list of words (`n` of them in a row), and `Or` joins it to the stock `Shapes`. `chunk` is how a
23//! `Sink` reads a bundle sent as base64 in `ds snapshot|telemetry <id> i/N` rows: it judges the
24//! text they encode, so the bundle is kept whole when it is innocent and covered whole when it is
25//! not. A bundle that is JSON meets the sink's whole `Redact`, names and word runs across its
26//! strings included, and is covered where the secret stands and sent on in the rows it came in.
27
28pub mod chunk;
29pub mod redact;
30pub mod row;
31pub mod shot;
32pub mod sink;
33#[cfg(feature = "async")]
34pub mod tap;
35
36pub use chunk::{
37 judge,
38 ChunkTag,
39 Verdict,
40};
41pub use redact::{
42 fingerprint,
43 secret_name,
44 secret_name_loose,
45 typed_name,
46 Deny,
47 NoTest,
48 Or,
49 Phrase,
50 Redact,
51 Shapes,
52 StrTest,
53};
54pub use row::{
55 compact,
56 Entry,
57 Row,
58};
59pub use shot::{
60 Answer,
61 Ask,
62 Filed,
63 ShotGates,
64 ShotRefusal,
65 Shots,
66};
67pub use sink::{
68 is_stamp,
69 now_ms,
70 sanitise,
71 stamp,
72 Gates,
73 Posted,
74 Refusal,
75 Sink,
76};
77#[cfg(feature = "async")]
78pub use tap::{
79 Dir,
80 Frame,
81 Tap,
82};