Skip to main content

Module relay_lists

Module relay_lists 

Source
Expand description

The relays an account says are its own, by what they are for, as the relays page shows and changes them.

Seven sets, in six lists:

  • Outbox and inbox: the relays the account writes to, where its notes are to be found, and the relays it reads, where what is meant for it is to be sent. Both are in its relay list (NIP-65, kind 10002): one r tag for each relay, marked write or read, or unmarked when it is both.
  • The others are each a list of relay tags (NIP-51): in the list’s tags, for anyone to read, or among the tags it keeps to itself, encrypted in its content as a bookmark list’s are. Where direct messages go (NIP-17, kind 10050), which is for anyone to read; the relays it searches (kind 10007); the relays profiles and relay lists are looked up on (kind 10086); the relays it trusts (kind 10089); and the relays it never connects to (kind 10006).

The list of relays an account keeps what is its alone on (kind 10013) is not among them: what is kept here and not published, a draft, is kept on this machine, and that list is neither read nor written.

A list is changed as Amethyst changes it, so that each client finds what the other left: everything in it that is not a relay stays as it was, and a relay stays where it was, said to anyone or kept private. One that is new goes where the list keeps its relays: among the public ones if those are all it has, and among the private ones otherwise; and in a first list, where lists of its kind keep them.

flowchart LR
    subgraph page["The relays page"]
        outbox["Outbox"]
        inbox["Inbox"]
        dm["Direct messages"]
        search["Search"]
        indexer["Indexer"]
        trusted["Trusted"]
        blocked["Blocked"]
    end
    outbox --> k10002["Kind 10002: r tags, marked write or read"]
    inbox --> k10002
    dm --> k10050["Kind 10050: relay tags, public"]
    search --> k10007["Kind 10007"]
    indexer --> k10086["Kind 10086"]
    trusted --> k10089["Kind 10089"]
    blocked --> k10006["Kind 10006"]
    k10007 --> halves["relay tags, in the list's tags or encrypted in its content"]
    k10086 --> halves
    k10089 --> halves
    k10006 --> halves

What each set is used for, and what a relay has to do to be of use in one (Section::hindrances), is in crate::guide::relays.

Structs§

ListedRelays
An account’s relays of one kind, as its newest list of that kind has them: a list of relay tags, some for anyone to read and some kept to itself, encrypted in its content as a bookmark list’s are.
RelayLists
An account’s relay lists, as they were last read.
RelaySets
An account’s relays, by what they are for.

Enums§

Hindrance
What a relay says of itself that gets in the way of what the set it is in is for.
Kept
What a list keeps to itself, as far as it was read.
Section
One of an account’s sets of relays.

Constants§

ADVERTISED_TAG 🔒
The name of the tag that names a relay in a relay list (NIP-65), and in the other lists of relays (NIP-51, NIP-17).
NIP_AUTH
NIP_SEARCH
The NIPs a relay has to support to be of use in one of the sets: search, and saying who is asking.
RELAY_TAG 🔒

Functions§

advertised
The relays the relay list list says its account writes to, and those it says it reads. None of either without a list.
advertised_list
The relay list (NIP-65) that replaces earlier, if there is one to replace: with outbox for the relays written to and inbox for those read, a relay in both named once, and whatever else earlier had in it as it was. The relays written to come in their order, and after them those that are only read, in theirs: a list has one order for both.
listed
The list of section that replaces earlier, if there is one to replace: with tags, and content for what it keeps to itself.
names_relay 🔒
Whether tag names a relay, as tags called name do in a list.
relays_named 🔒
The relays that the tags fields call name, each once, in their order.
replacing 🔒
When the list that replaces earlier is written: at now or, if earlier claims to be from later, after it. It has to be the newer of the two.
typed_relay
The relay typed names, as someone types one: its address, with or without the wss:// nearly all of them start with.