Skip to main content

Module relay

Module relay 

Source
Expand description

com.atproto.sync.requestCrawl and notifyOfUpdate, called outward.

These are the two com.atproto.* methods this crate is a client of rather than a server for. A relay discovers a new personal data server by subscribing to its subscribeRepos — but nothing makes a relay dial an address it has never heard of. requestCrawl is the announcement: “I exist, my hostname is this, please open a subscription.” Without ever sending it, subscribeRepos is a stream nobody is listening to, and the symptom is silence — no error, no refused write, just an account that never appears anywhere a relay indexes. notifyOfUpdate is the same request against a different, deprecated NSID — upstream’s own schema says to use requestCrawl instead — kept here because a relay that dropped a subscription mid-stream is the one case its description names specifically, and an operator recovering from that gets to call the method upstream still names for it.

§When either fires

Neither fires on its own. Both are operator-triggered: naming a relay does not announce anything by itself, so an operator asks explicitly rather than a restart asking for them. There is no startup announce and no timer. This module itself has no opinion on when it is called; it only answers what happened when it was.

§What a failure does

Nothing to serving, because nothing on the request-serving path calls into this module at all. RelayClient::request_crawl and RelayClient::notify_of_update return a typed RelayCrawlError to their caller, distinguishing a relay that refused (Refused, including HostBanned) from one that could not be reached at all (Unreachable). There is no log-only failure path here: the operator who asked is the channel.

§Which relays, and localhost

Configurable — RelaySection in didbot-config, or --relay-hostname on didbot-pds directly, once per relay — never hardcoded, because this project vendors nobody’s relay address as a default. A development run against *.localhost has no relay reachable from it and no hostname a relay could ever resolve back to this machine, so didbot-pds.rs never wires ANNOUNCE up for a loopback zone even when a relay is configured; see that binary’s own call site.

Structs§

RelayClient
Calls requestCrawl or notifyOfUpdate against one relay.
RelayTarget
The relays an operator’s announce reaches, and the hostname it announces.
RequestCrawlBody 🔒
Body of both requestCrawl’s and notifyOfUpdate’s request — the two lexicons declare the identical {"hostname": ..} shape.

Enums§

RelayCrawlError
Why a relay did not end up crawling this server.

Constants§

MAX_ERROR_BODY 🔒
How much of a non-success response body RelayCrawlError::Refused keeps: a relay answering with a large page must not flood the log this failure is reported to.
NOTIFY_OF_UPDATE_NSID
com.atproto.sync.notifyOfUpdate’s NSID. Deprecated upstream in favor of requestCrawl — same request shape, same effect, different name — kept here for the one case its own description names: recovering from a gap after a relay’s subscription dropped.
REQUEST_CRAWL_NSID
com.atproto.sync.requestCrawl’s NSID, for the URL this client builds and for anything that wants to name the method in a log line.
REQUEST_TIMEOUT
How long RelayClient::request_crawl and RelayClient::notify_of_update wait before giving up.

Functions§

request_crawl_body
The JSON body a requestCrawl or notifyOfUpdate call sends, built in isolation from any network concern so a test can check it against either vendored lexicon’s input schema without standing up a server.