152 Commits

Author SHA1 Message Date
Your Name
c0051b22be v1.1.7 - Add per-connection database query tracking for abuse detection
Implemented comprehensive database query tracking to identify clients causing
high CPU usage through excessive database queries. The relay now tracks and
displays query statistics per WebSocket connection in the admin UI.

Features Added:
- Track db_queries_executed and db_rows_returned per connection
- Calculate query rate (queries/minute) and row rate (rows/minute)
- Display stats in admin UI grouped by IP address and WebSocket
- Show: IP, Subscriptions, Queries, Rows, Query Rate, Duration

Implementation:
- Added tracking fields to per_session_data structure
- Increment counters in handle_req_message() and handle_count_message()
- Extract stats from pss in query_subscription_details()
- Updated admin UI to display IP address and query metrics

Use Case:
Admins can now identify abusive clients by monitoring:
- High query rates (>50 queries/min indicates polling abuse)
- High row counts (>10K rows/min indicates broad filter abuse)
- Query patterns (high queries + low rows = targeted, high both = crawler)

This enables informed decisions about which IPs to blacklist based on
actual resource consumption rather than just connection count.
v1.1.8
2026-02-01 16:26:37 -04:00
Your Name
4cc2d2376e v1.1.6 - Optimize: Deduplicate kinds in subscription index to prevent redundant operations
The kind index was adding subscriptions multiple times when filters contained
duplicate kinds (e.g., 'kinds': [1, 1, 1] or multiple filters with same kind).
This caused:
- Redundant malloc/free operations during add/remove
- Multiple index entries for same subscription+kind pair
- Excessive TRACE logging (7+ removals for single subscription)
- Wasted CPU cycles on duplicate operations

Fix:
- Added bitmap-based deduplication in add_subscription_to_kind_index()
- Uses 8KB bitmap (65536 bits) to track which kinds already added
- Prevents adding same subscription to same kind index multiple times
- Reduces index operations by 3-10x for subscriptions with duplicate kinds

Performance Impact:
- Eliminates redundant malloc/free cycles
- Reduces lock contention on kind index operations
- Decreases log volume significantly
- Should reduce CPU usage by 20-40% under production load
v1.1.7
2026-02-01 15:59:54 -04:00
Your Name
30dc4bf67d v1.1.5 - Fix CRITICAL segfault: Use wrapper nodes for no-kind-filter subscriptions
The kind index optimization in v1.1.4 introduced a critical bug that caused
segmentation faults in production. The bug was in add_subscription_to_kind_index()
which directly assigned sub->next for no-kind-filter subscriptions, corrupting
the main active_subscriptions linked list.

Root Cause:
- subscription_t has only ONE 'next' pointer used by active_subscriptions list
- Code tried to reuse 'next' for no_kind_filter_subs list
- This overwrote the active_subscriptions linkage, breaking list traversal
- Result: segfaults when iterating subscriptions

Fix:
- Added no_kind_filter_node_t wrapper structure (like kind_subscription_node_t)
- Changed no_kind_filter_subs from subscription_t* to no_kind_filter_node_t*
- Updated add/remove functions to use wrapper nodes
- Updated broadcast function to iterate through wrapper nodes

This follows the same pattern already used for kind_index entries and
prevents any corruption of the subscription structure's next pointer.
v1.1.6
2026-02-01 12:37:07 -04:00
Your Name
a1928cc5d7 v1.1.4 - Add kind-based index for 10x subscription matching performance improvement v1.1.5 2026-02-01 11:15:26 -04:00
Your Name
7bf0757b1f v1.1.3 - Rename VERSION to CRELAY_VERSION to avoid conflict with nostr_core_lib v1.1.4 2026-02-01 10:02:19 -04:00
Your Name
11b0a88cdd v1.1.2 - Fix hardcoded version string in print_version() - use VERSION define from main.h
The print_version() function was displaying a hardcoded 'v1.0.0' string instead
of using the VERSION define from main.h. This caused version mismatches where
the git tag and main.h showed v1.1.1 but the binary reported v1.0.0.

Now print_version() uses the VERSION macro, ensuring all version displays are
consistent and automatically updated when increment_and_push.sh updates main.h.
v1.1.3
2026-01-31 16:48:11 -04:00
Your Name
e8f8e3b0cf v1.1.1 - Fix NOTICE message silent failure - add pss parameter to send_notice_message()
Previously, send_notice_message() called queue_message() with NULL pss, causing
all NOTICE messages to fail silently. This affected filter validation errors
(e.g., invalid kinds > 65535 per NIP-01) where clients received no response.

Changes:
- Updated send_notice_message() signature to accept struct per_session_data* pss
- Updated 37 call sites across websockets.c (31) and nip042.c (6)
- Updated forward declarations in main.c, websockets.c, and nip042.c
- Added tests/invalid_kind_test.sh to verify NOTICE responses for invalid filters

Fixes issue where REQ with kinds:[99999] received no response instead of NOTICE.
v1.1.2
2026-01-31 15:48:29 -04:00
Your Name
35b1461ff6 v1.1.0 - Documentation restructure: New README.md and comprehensive API.md 2026-01-23 06:58:14 -04:00
Your Name
87c6aa5e16 . v1.1.0 2025-12-21 09:30:48 -04:00
Your Name
f0462929ea v1.0.9 - Fix active_subscriptions_log view to check ended_at column instead of looking for separate close events (schema v9) 2025-12-09 06:29:36 -04:00
Your Name
0ccf1959c2 v1.0.8 - Remove limit from subscription count v1.0.9 2025-12-07 07:40:17 -04:00
Your Name
ef172c8356 v1.0.7 - Added a clean startup to erase subscriptions. v1.0.8 2025-12-06 18:26:22 -04:00
Your Name
ae0370b47f v1.0.6 - Working on cleaning up subscriptions which were piling up. Set a startup cleanup, and a connection age limit. v1.0.7 2025-12-05 07:37:57 -04:00
Your Name
137df6253d v1.0.5 - Just catching up v1.0.6 2025-11-11 17:01:39 -04:00
Your Name
79f06bf1ed v1.0.4 - Fixed web socket limitation with the number of npubs in a subscription v1.0.5 2025-11-07 19:59:34 -05:00
laan tungir
9e5a42fd3c v1.0.3 - From remote v1.0.4 2025-11-07 14:07:46 -05:00
laan tungir
553d398ef5 removed some files v1.0.3 2025-11-03 07:33:12 -05:00
Your Name
ac0bf17c4f v1.0.0 - First major release 2025-11-01 07:04:56 -04:00
Your Name
4efd7140d7 Reset version back to v0.8.6 v0.8.6 v1.0.0 2025-11-01 07:03:39 -04:00
Your Name
43b9027d4a v7.0.0 - Version 1.0.0 2025-11-01 06:56:02 -04:00
Your Name
9a0b2714f5 v7.0.0 - Version 1.0.0 2025-10-31 11:17:34 -04:00
Your Name
10fc80aa07 v6.0.0 - Test fixed output redirection 2025-10-31 11:17:19 -04:00
Your Name
9fa4e1dcf1 v6.0.0 - Version 1.0.0 2025-10-31 11:15:32 -04:00
Your Name
11c9f8c2a4 v5.0.0 - Test fixed release ID extraction 2025-10-31 11:15:16 -04:00
Your Name
17ddf3f2b8 v5.0.0 - Version 1.0.0 2025-10-31 11:13:41 -04:00
Your Name
f70d5077e8 v4.0.0 - Debug upload with existing binary 2025-10-31 11:13:21 -04:00
Your Name
19cc1fa804 v4.0.0 - Debug upload issue 2025-10-31 11:12:58 -04:00
Your Name
ed1de7d32d v4.0.0 - Version 1.0.0 2025-10-31 11:11:31 -04:00
Your Name
7b02c6a2cb v3.0.0 - Test release upload fix 2025-10-31 11:10:53 -04:00
Your Name
dba229040d v3.0.0 - Version 1.0.0 2025-10-31 11:08:18 -04:00
Your Name
d8b09e0dbb v2.0.0 - Version 1.0.0 2025-10-31 11:06:27 -04:00
Your Name
73fb681118 v1.0.0 - Version 1.0.0) 2025-10-31 10:39:06 -04:00
Your Name
cf0f606dd9 v0.8.5 - cleanup 2025-10-30 07:06:48 -04:00
Your Name
cb165ddab1 v0.8.4 - Updated increment_and_push.sh v0.8.5 2025-10-30 07:03:22 -04:00
Your Name
58eb19e4e7 v0.8.3 - --dry-run v0.8.4 2025-10-30 06:52:05 -04:00
Your Name
aeaecddb5a v0.8.2 - markdown intro v0.8.3 2025-10-29 07:53:56 -04:00
Your Name
09dff8e91f v0.8.1 - added screenshots v0.8.2 2025-10-29 07:39:08 -04:00
Your Name
f49aae8ab0 v0.7.44 - Release v0.8.0 with NIP-59 timestamp randomization and status command fixes v0.8.1 2025-10-27 13:21:47 -04:00
Your Name
f6debcf799 v0.7.44 - Release v0.8.0 with NIP-59 timestamp randomization and status command fixes 2025-10-27 13:19:58 -04:00
Your Name
edbc4f1359 v0.7.43 - Add plain text 'status' command handler for NIP-17 DMs 2025-10-27 13:19:10 -04:00
Your Name
5242f066e7 Update nostr_core_lib with timestamp randomization feature v0.7.43 2025-10-27 12:59:19 -04:00
Your Name
af186800fa v0.7.42 - Fix ephemeral event storage and document monitoring system 2025-10-26 15:02:00 -04:00
Your Name
2bff4a5f44 v0.7.41 - Fix SQL query routing in admin API - add missing sql_query case to handle_kind_23456_unified v0.7.42 2025-10-26 13:34:16 -04:00
Your Name
edb73d50cf v0.7.40 - Removed event_broadcasts table and related code to fix FOREIGN KEY constraint failures preventing event insertion v0.7.41 2025-10-25 15:26:31 -04:00
Your Name
3dc09d55fd v0.7.39 - Set dm's back 2 days to adjust for timestamp ramdomization of giftwraps. v0.7.40 2025-10-23 18:43:45 -03:00
Your Name
079fb1b0f5 v0.7.38 - Fixed error upon startup with existing db v0.7.39 2025-10-23 11:17:16 -04:00
Your Name
17b2aa8111 v0.7.37 - Enhanced admin interface with sliding sidebar navigation, moved dark mode and logout to sidebar footer, improved button styling consistency v0.7.38 2025-10-22 12:43:09 -04:00
Your Name
78d484cfe0 v0.7.36 - Implement sliding side navigation menu with page switching for admin sections v0.7.37 2025-10-22 11:01:30 -04:00
Your Name
182e12817d v0.7.35 - Implement event-driven monitoring system with dual triggers for events and subscriptions v0.7.36 2025-10-22 10:48:57 -04:00
Your Name
9179d57cc9 v0.7.34 - We seemed to maybe finally fixed the monitoring error? v0.7.35 2025-10-22 10:19:43 -04:00