The goal with this would be to replace Syncthing’s specialized discovery system with a nostr-based one. This would mean no single-purpose servers would be needed, as any generic nostr relay could be used.
@calmh , you said your main goal is to remove yourself as a central point of failure. I think Nostr would achieve this. Any user could point their Syncthing client to any of the thousands of existing, free public Nostr relays. You don’t have to trust the server operator because the server is just a dumb pipe passing encrypted JSON.
As to your question specifically, we wouldn’t have to constantly query hundreds of relays. A client could, however, send a NIP-65 relay list to as many relays as possible. This is a small note that says “I’m device X, and I use the following relays…”. As long as two devices have just a single overlap in that initial list, then they would immediately know the entire list of relays the other device uses. On Nostr there are many popular relays used mainly for just publishing your relay list. So those would be easy places to first look, but it’s of course not necessary, any could be used. So a device posts updates to a handful of relays. It can post this list of relays to as many places as possible. If some of its relays go down, it can just update that list.
This allows the network to “self-heal” in case of outages, censorship, etc. As long as a single relay is known about in common, then two devices can exchange a new list of relays.
I initially said ephemeral knock+callback events could be used, but on further thought I think this would drain battery because it would require always-open websockets. Instead it could be done lazily like it currently is.
A device could have a handful of relays (or any amount) that it posts updates to. This is its relay list. NIP-16 and NIP-40 could be used. NIP-16 tells a relay the event is replaceable. So when the relay receives a new update (device IP info, or whatever) it replaces the previous one in-place. So a relay wouldn’t get bogged down with data, it would only carry the latest update. NIP-40 adds an expiration tag to the event. Say 30 minutes. After that time, the relay deletes the info. This would prevent relay bloat or long-term storage. Also devices wouldn’t try connecting over outdated info or to devices that are offline.
Nostr relays are lightweight enough that there are apps for running a full relay from your phone.
NIP-44 + NIP-59 could be maybe be used for privacy. It would allow these updates to be completely encrypted. I’m not too familiar with how that actually works in practice though.
The main issue I see with this is that Syncthing uses TLS for cryptography, while nostr uses secp256k1 and Schnorr signatures to verify authenticity of update info.
I’m not too familiar with how Syncthing relays work, but maybe it’s even possible to utilize nostr relays for that as well. But that’s something else to investigate.