upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/nostr.h
diff options
context:
space:
mode:
authorBitflash-sh <btf01@proton.me>2026-07-24 12:13:30 -0300
committerBitflash-sh <btf01@proton.me>2026-07-24 12:13:30 -0300
commit3efd9a089cc6b924d9bc917d3d8145f7c01265ad (patch)
tree5c4d1bc9a487e54fb0ec5b386dbd4360b6779f42 /src/nostr.h
parent51d617e70f90a972185917ea0096c1ecef2bfa8b (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.h15
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)
16void ThreadNostrSeed(void* parg); 17void ThreadNostrSeed(void* parg);
@@ -19,9 +20,17 @@ void ThreadNostrSeed(void* parg);
19extern const char* pszNostrRelays[]; 20extern const char* pszNostrRelays[];
20extern const int nNostrRelays; 21extern 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
24extern 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.
27extern std::vector<std::string> vBtfMeetingRelays;
28// The relay this node is currently registered at (set by ThreadBtfAccept).
29extern std::string strBtfActiveRelay;
30// The active relay, or the first seed if none active yet ("" if the list is empty).
31std::string BtfActiveRelay();
32// Record the relay this node just registered its service at (thread-safe).
33void 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.