diff options
| author | eunhhu <[email protected]> | 2026-09-28 19:42:27 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-28 19:42:27 +0100 |
| commit | 3308de49adfdb2a55c646e6b675da998f2c36900 (patch) | |
| tree | 6548fc239b9f0ab8aabd32747fbaae0fd5517e44 /serve/link.h | |
| parent | 63cc9554f2cd93e46d0413a21cbce05014e2f2b3 (diff) | |
| download | pure-3308de49adfdb2a55c646e6b675da998f2c36900.tar.gz pure-3308de49adfdb2a55c646e6b675da998f2c36900.zip | |
Remember each sender's secret beside the node's key: no X25519 at restart
A listener lets a quiet sender's secret go with its active state, so a
node started again made one X25519 for every sender that came back (169
us on this Pi, most of a wake's CPU): asymmetric work in proportion to the
links, which design 011 counts as a reason to design again. The secret is
now remembered in a file beside the key (KEY.links, 0600, begun again for
another node's key): a place of 64 bytes a sender in the order allowed,
mapped, so a sender at rest takes no memory for it. A place is the first
28 bytes of the sender's key, a check (FNV-1a of the key and the secret)
and the secret, written secret first and key last; a place whose check
fails is made again. The UDP link checks see a receiver started again
make no X25519.
Diffstat (limited to 'serve/link.h')
| -rw-r--r-- | serve/link.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/serve/link.h b/serve/link.h index 51f12bd..b831ab4 100644 --- a/serve/link.h +++ b/serve/link.h @@ -89,6 +89,12 @@ bool pure_link_allow(PureLinkListener *, const char *source, const unsigned char * keys, addresses and streams go: an idle link costs the listener only its * allowing, and the sender's next packet makes them again (one X25519). */ void pure_link_idle(PureLinkListener *, uint64_t ms); +/* Remember the secret each sender's key shares with the node's in a file + * (path, 0600; begun again for another node's key): a place a sender in + * the order allowed, mapped, so a sender at rest takes no memory for it. + * A node that starts again then makes no X25519 for a sender it heard from + * before. After the senders are allowed, before serving. */ +bool pure_link_remember(PureLinkListener *, const char *path, char *error, size_t size); bool pure_link_serve(PureLinkListener *, char *error, size_t size); /* stored: the delivery's save succeeded; gap: it stopped at a gap. */ void pure_link_done(PureLinkListener *, void *token, uint64_t heard, bool stored, bool gap); @@ -96,10 +102,10 @@ void pure_link_done(PureLinkListener *, void *token, uint64_t heard, bool stored /* Counts for a host's report: packets and records sent, records sent again, * packets lost and acknowledged, packets received, deliveries handed over, * the last number stored; a listener's senders woken (their active state - * made), let go when idle, and active when it closed. A listener's are - * given when it closes. */ + * made), of them with a secret remembered (no X25519), let go when idle, + * and active when it closed. A listener's are given when it closes. */ typedef struct { - uint64_t packets, records, resent, lost, acknowledged, received, deliveries, stored, woken, swept, active; + uint64_t packets, records, resent, lost, acknowledged, received, deliveries, stored, woken, remembered, swept, active; } PureLinkCounts; void pure_link_counts(PureLink *, PureLinkCounts *); void pure_link_listener_close(PureLinkListener *, PureLinkCounts *counts); |
