Expand description
The relay Avestruz runs itself, for what is the account’s alone: what is written and not published, and whatever else is not for any other relay.
It is a relay like any other, over the same event store the client keeps, but it listens nowhere: on no port, and on no socket file. A connection to it is a pipe made inside this process, one end handed to the relay and the other kept, so there is nothing for another program to open, and Avestruz is the only client it has.
That is the relay, not the store under it: the store is a file, and whoever can read the user’s files can read that one. What is written and not published is encrypted in it.
The relay takes the events of the account that is signed in, and no
others. Avestruz talks to it as a client talks to any relay: an event
is sent and its OK waited for, a question is asked and its answers
read until the relay says that is all.
sequenceDiagram
participant client as PrivateRelay: send or ask
participant near as The near end of a pipe
participant far as The far end
participant relay as LocalRelay
participant store as Event store
client->>near: a pipe is made, in memory
client->>relay: take this connection (the far end)
client->>near: EVENT, or REQ, as WebSocket frames
near->>far: bytes
far->>relay: the message
relay->>relay: is the event signed by the account signed in?
relay->>store: kept, or read
relay-->>client: OK, or the events and EOSE, back the same way
client->>near: closed, and the relay's end of it is doneEach send and each ask makes a pipe of its own and closes it. The
two ends speak WebSocket from the first byte, since that is what the
relay library takes a connection as; there is no HTTP request to open
it, and nothing listens.
What goes to this relay, and why, is in crate::guide::relays.
Structs§
- Owners
Alone 🔒 - Takes the events the account signed in wrote, and no others; with nobody signed in, none at all.
- Private
Relay - The relay Avestruz runs itself, and the way to it. Clones are the same relay; it is gone when the last of them is.
Constants§
- ANSWER_
TIMEOUT 🔒 - How long the relay has to answer.
- PEER 🔒
- The address the relay is told its connections are from: they are all from this process, and a pipe has none.
- PIPE_
BYTES 🔒 - How much either end of a connection may have written that the other has not read yet. The writer waits when it is that much.