diff options
| author | Bitflash-sh <btf01@proton.me> | 2026-07-24 12:13:30 -0300 |
|---|---|---|
| committer | Bitflash-sh <btf01@proton.me> | 2026-07-24 12:13:30 -0300 |
| commit | 3efd9a089cc6b924d9bc917d3d8145f7c01265ad (patch) | |
| tree | 5c4d1bc9a487e54fb0ec5b386dbd4360b6779f42 /src/nostr.h | |
| parent | 51d617e70f90a972185917ea0096c1ecef2bfa8b (diff) | |
Multi-relay rendezvous with failover + relay rate-limiting
Seed list of 3 geographically-spread relays (Sao Paulo, New Jersey, Almaty);
nodes register at the first reachable one and fail over if it is attacked or
goes down, so no single relay IP is a point of failure. Relay installer now
applies iptables connection rate-limits to soak up single-source floods.
Diffstat (limited to 'src/nostr.h')
| -rw-r--r-- | src/nostr.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/nostr.h b/src/nostr.h index 5ec9f65..41e59df 100644 --- a/src/nostr.h +++ b/src/nostr.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #define BITFLASH_NOSTR_H | 11 | #define BITFLASH_NOSTR_H |
| 12 | 12 | ||
| 13 | #include <string> | 13 | #include <string> |
| 14 | #include <vector> | ||
| 14 | 15 | ||
| 15 | // Thread entry point (signature compatible with _beginthread) | 16 | // Thread entry point (signature compatible with _beginthread) |
| 16 | void ThreadNostrSeed(void* parg); | 17 | void ThreadNostrSeed(void* parg); |
| @@ -19,9 +20,17 @@ void ThreadNostrSeed(void* parg); | |||
| 19 | extern const char* pszNostrRelays[]; | 20 | extern const char* pszNostrRelays[]; |
| 20 | extern const int nNostrRelays; | 21 | extern const int nNostrRelays; |
| 21 | 22 | ||
| 22 | // Rendezvous meeting relay ("host:port") this node registers at and advertises | 23 | // Rendezvous meeting relays ("host:port") this node can register its .btf |
| 23 | // in its .btf descriptor. Overridable with /rvrelay=host:port. | 24 | // service at. It registers at the first reachable one and advertises that in |
| 24 | extern std::string strBtfMeetingRelay; | 25 | // its descriptor; if the relay dies it fails over to another, so attacking a |
| 26 | // single relay's IP can't take the network down. Overridable with /rvrelay. | ||
| 27 | extern std::vector<std::string> vBtfMeetingRelays; | ||
| 28 | // The relay this node is currently registered at (set by ThreadBtfAccept). | ||
| 29 | extern std::string strBtfActiveRelay; | ||
| 30 | // The active relay, or the first seed if none active yet ("" if the list is empty). | ||
| 31 | std::string BtfActiveRelay(); | ||
| 32 | // Record the relay this node just registered its service at (thread-safe). | ||
| 33 | void BtfSetActiveRelay(const std::string& relay); | ||
| 25 | 34 | ||
| 26 | // Copy this node's .btf identity (lazily loading or generating it): the x-only | 35 | // Copy this node's .btf identity (lazily loading or generating it): the x-only |
| 27 | // pubkey (= the .btf address) and the x25519 secret for the end-to-end channel. | 36 | // pubkey (= the .btf address) and the x25519 secret for the end-to-end channel. |