lib/reticulum/src/node/transport/link/root.zig
daab053ee43316e1809a84551d573ddd1e5bf3d2
1 //! A node needs records and steps to move the packets of encrypted sessions
2 //! that run between other pairs of nodes through itself. Two programs that want
3 //! an encrypted session between them may sit many hops apart, so each node
4 //! along the way has to pass the request outward, the answer back, and the
5 //! traffic both ways.
6 //!
7 //! A node in the middle holds none of the session keys, so it tells the two
8 //! directions apart by the hop count a packet carries (the byte in the packet
9 //! header that rises by one at every node the packet passes through) and the
10 //! network interface it arrived on. A request that is never answered would hold
11 //! its record for good, so each record carries a deadline. The record store
12 //! holds a fixed number of sessions in storage its caller supplies, so a
13 //! request arriving with the store full is dropped whole, leaving no
14 //! half-written record.
15 //!
16 //! Reticulum 1.5.0, the reference implementation this package is a port of,
17 //! pinned to one upstream commit, answers these with a record per carried
18 //! session at every node that carries traffic for others, keyed by the 16-byte
19 //! id both ends derive from the request. Each record carries a deadline per
20 //! remaining hop for the signed answer to come back, and a sweep drops records
21 //! past their deadline, at Reticulum@1.5.0 RNS/Transport.py:1998-2010,843-856.
22 //! The lineage is checkable in this tree: the package README pins the upstream
23 //! commit the port follows, and the conformance corpus under src/conformance is
24 //! generated from that release and drives the differential tests.
25 //!
26 //! This port asks its caller to wake the node at the earliest deadline any
27 //! record holds (a *node timer*), so a record ends at its own deadline. The
28 //! reference sweeps every second. `relay.zig` lists every departure from the
29 //! reference.
30 //!
31 //! The subtree holds two modules: `entries` keeps one record per carried
32 //! session with its deadline, and `relay` holds the steps that forward the
33 //! request, carry the signed answer back, pass the traffic, and drop a record
34 //! at its deadline.
35 //!
36 //! - *link*: an encrypted session between two endpoints, named by a 16-byte
37 //! link id that both ends derive from the request packet.
38 //! - *link id*: the 16-byte name of one link, the same at every node the link
39 //! crosses.
40 //! - *proof*: a signed packet returned to confirm an earlier packet, which for
41 //! a link request is the responder accepting the link.
42 //! - *carrier*: one network interface the node sends and receives over, named
43 //! by a small integer index.
44 //! - *transport node*: a node that carries traffic on behalf of other nodes, as
45 //! well as sending and receiving its own.
46
47 pub const entries = @import("entries.zig");
48 pub const relay = @import("relay.zig");