From 3efd9a089cc6b924d9bc917d3d8145f7c01265ad Mon Sep 17 00:00:00 2001 From: Bitflash-sh Date: Fri, 24 Jul 2026 12:13:30 -0300 Subject: 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. --- src/nostr.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/nostr.h') 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 @@ #define BITFLASH_NOSTR_H #include +#include // Thread entry point (signature compatible with _beginthread) void ThreadNostrSeed(void* parg); @@ -19,9 +20,17 @@ void ThreadNostrSeed(void* parg); extern const char* pszNostrRelays[]; extern const int nNostrRelays; -// Rendezvous meeting relay ("host:port") this node registers at and advertises -// in its .btf descriptor. Overridable with /rvrelay=host:port. -extern std::string strBtfMeetingRelay; +// Rendezvous meeting relays ("host:port") this node can register its .btf +// service at. It registers at the first reachable one and advertises that in +// its descriptor; if the relay dies it fails over to another, so attacking a +// single relay's IP can't take the network down. Overridable with /rvrelay. +extern std::vector vBtfMeetingRelays; +// The relay this node is currently registered at (set by ThreadBtfAccept). +extern std::string strBtfActiveRelay; +// The active relay, or the first seed if none active yet ("" if the list is empty). +std::string BtfActiveRelay(); +// Record the relay this node just registered its service at (thread-safe). +void BtfSetActiveRelay(const std::string& relay); // Copy this node's .btf identity (lazily loading or generating it): the x-only // pubkey (= the .btf address) and the x25519 secret for the end-to-end channel. -- cgit v1.2.3