diff options
| author | Your Name <you@example.com> | 2026-05-19 02:31:19 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-19 02:32:41 +0530 |
| commit | 81f2dc52dc42d01c89dff45a5407ec40b8863052 (patch) | |
| tree | 15018c2438639ca89dc6d33a5144c10d0b1c2af0 /main/config.h | |
| parent | 75688d55b3c8d13c8c9a50da9668ec408f684cb3 (diff) | |
feat: local Nostr relay with relay selection, sync, and integration tests
Local Nostr relay (NIP-01) on port 4869 with LittleFS 4MB storage.
All events published locally first, then synced to public relays via REQ-diff.
Relay selection via NIP-11 HTTP probing with NIP-77 scoring and auto-failover.
Components:
- wisp_relay: 16-file local relay (ws_server, storage_engine, sub_manager,
broadcaster, relay_validator, router, handlers, rate_limiter, nip11,
deletion, flash_monitor, relay_types)
- esp_littlefs: LittleFS VFS integration (git submodule)
- negentropy: for future NIP-77 binary sync (git submodule)
New source files:
- local_relay.c/h: thin wrapper for relay init/start/publish
- relay_selector.c/h: NIP-11 probe + scoring + auto-failover
- sync_manager.c/h: REQ-diff sync (primary 30min, fallback 6h)
Bug fixes:
- config.c: use-after-free (cJSON_Delete before seed_relays/sync parsing)
- local_relay: moved init to app_main for boot-time start (not gated on STA IP)
Flash layout: 4MB LittleFS partition at 0x500000 for relay_store
Test results (Board B, live hardware):
- Smoke: ping + HTTP 4869 + NIP-11: PASS
- NIP-11 info document: 10/11 PASS
- WS pub/sub (connect, REQ/EOSE, EVENT/OK, CLOSE, concurrent): 6/6 PASS
- Unit tests (relay_validator + relay_selector): 13/13 PASS
Hardware test make targets in physical-router-test-automation/:
- make relay-build, relay-flash-b, relay-test-smoke/nip11/pubsub/sync/full
Diffstat (limited to 'main/config.h')
| -rw-r--r-- | main/config.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/main/config.h b/main/config.h index fa4d95c..1e580e9 100644 --- a/main/config.h +++ b/main/config.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #define TOLLGATE_MAX_AP_SSID_LEN 32 | 13 | #define TOLLGATE_MAX_AP_SSID_LEN 32 |
| 14 | #define TOLLGATE_MAX_AP_PASS_LEN 64 | 14 | #define TOLLGATE_MAX_AP_PASS_LEN 64 |
| 15 | #define TOLLGATE_MAX_RELAYS 4 | 15 | #define TOLLGATE_MAX_RELAYS 4 |
| 16 | #define TOLLGATE_MAX_SEED_RELAYS 8 | ||
| 16 | 17 | ||
| 17 | typedef struct { | 18 | typedef struct { |
| 18 | char ssid[32]; | 19 | char ssid[32]; |
| @@ -63,6 +64,11 @@ typedef struct { | |||
| 63 | 64 | ||
| 64 | bool cvm_enabled; | 65 | bool cvm_enabled; |
| 65 | char cvm_relays[256]; | 66 | char cvm_relays[256]; |
| 67 | |||
| 68 | char nostr_seed_relays[TOLLGATE_MAX_SEED_RELAYS][128]; | ||
| 69 | int nostr_seed_relay_count; | ||
| 70 | int nostr_sync_interval_s; | ||
| 71 | int nostr_fallback_sync_interval_s; | ||
| 66 | } tollgate_config_t; | 72 | } tollgate_config_t; |
| 67 | 73 | ||
| 68 | void tollgate_config_derive_unique(tollgate_config_t *cfg); | 74 | void tollgate_config_derive_unique(tollgate_config_t *cfg); |