115 Commits

Author SHA1 Message Date
Yonle
dbe7250965 bouncer: temporary remove orphan feature
Signed-off-by: Yonle <yonle@lecturify.net>
2024-02-16 23:00:52 +07:00
Yonle
82e1838f2c bouncer: Relays handling rework
Signed-off-by: Yonle <yonle@lecturify.net>
2024-02-16 22:55:53 +07:00
Yonle
1206f592f5 fix commit 568ea5b 2024-02-03 15:59:58 +07:00
Yonle
568ea5b428 bouncer: handle <filter.ids> the same way as handling <filter.limit>
Signed-off-by: Yonle <yonle@lecturify.net>
2024-02-03 15:44:56 +07:00
Yonle
356a985ede bouncer: small typo on handling aliases
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-31 20:46:43 +07:00
Yonle
22486202e4 also handle after client close
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-29 22:36:06 +07:00
Yonle
990c8b2202 also need to delete these aliases
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-29 22:08:16 +07:00
Yonle
366905149f bouncer: In bouncer side, Try do different approach for REQ-ing.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-29 22:03:39 +07:00
Yonle
3429f449ad bouncer: disable eose_timeout by default or when unspecified
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-29 21:41:52 +07:00
Yonle
a46b56adad bouncer: close an already opened subscription
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-29 21:36:20 +07:00
Yonle
5d6e35ae7e bouncer: also check for kinds filter
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-27 23:12:11 +07:00
Yonle
a0ec8bd2bc bouncer: do not keep unauthorized session.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-27 23:05:53 +07:00
Yonle
67e44ffb84 http&bouncer: enable synchronousEvents & deflate compression by default.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-27 19:42:18 +07:00
Yonle
8f3689a1c7 bouncer: more cFilter handling.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-27 07:38:04 +07:00
Yonle
7a71bcd779 major bugfix: fix sock readyState handler
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-27 07:33:15 +07:00
Yonle
d0b040fbb9 bouncer: logger: no need to tell clearing orphan sessions when max_orphan_sess is 0.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-24 16:33:06 +07:00
Yonle
e166e0821b bouncer: show IP when disconnected.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-24 16:11:49 +07:00
Yonle
c356fbfcf7 make socket termination faster and fix handling onClose
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-23 22:49:43 +07:00
Yonle
ec773eebe4 use strict, reveal bostr version in user agent
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-23 21:21:46 +07:00
Yonle
a3b4c20567 add feature for ratelimits.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-23 21:12:06 +07:00
Yonle
8863a73c65 http: favicon support.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-09 06:58:27 +07:00
Yonle
d0b8a6b3da just a improvement on orphan session logging.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-05 00:14:26 +07:00
Yonle
224bf54133 log with user-agent.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 23:51:46 +07:00
Yonle
5ba3980a9e feat: broadcast_ratelimit & incomming_ratelimit
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 22:06:32 +07:00
Yonle
829974b893 fixbug on bouncer.js
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 14:54:23 +07:00
Yonle
9815e5fecc no need for updateSess
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 14:51:06 +07:00
Yonle
06ac5ed15c bouncer: updateSess() after client disconnect too.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 13:56:47 +07:00
Yonle
8b955f121f socket: use nodelay
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 13:36:14 +07:00
Yonle
70b9e9327a another NIP-01 improvements.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 13:09:06 +07:00
Yonle
2a9abe64ea bouncer: send CLOSED to client as per recent NIP-01
From https://github.com/nostr-protocol/nips/blob/master/01.md#from-relay-to-client-sending-events-and-notices
> ["CLOSED", <subscription_id>, <message>], used to indicate that a subscription was ended on the server side.
> CLOSED messages MUST be sent in response to a REQ when the relay refuses to fulfill it. It can also be sent when a relay decides to kill a subscription on its side before a client has disconnected or sent a CLOSE.

Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 12:26:48 +07:00
Yonle
91637c13f9 g r a m m a r
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 23:54:44 +07:00
Yonle
29cb8ab5ed properly clear orphaned session.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 22:51:16 +07:00
Yonle
53cf7a1562 fixbug
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 22:30:05 +07:00
Yonle
ca5f9f7a8e bouncer: count on orphans
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 21:51:15 +07:00
Yonle
26462d16df orphan sess: admin sess must destroyed
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 17:15:41 +07:00
Yonle
7d0583791f fix another potential memory leak
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 17:13:07 +07:00
Yonle
d81cc497f8 fixbug 2024-01-03 16:52:32 +07:00
Yonle
a404e79104 probably an fix for orphan sockets & fix potential memory leak
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 16:51:23 +07:00
Yonle
75c39b6bf5 yeet
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 16:27:40 +07:00
Yonle
bcc5c46979 remove useless code.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 16:24:02 +07:00
Yonle
7d5ab86756 orphan: send CLOSE
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 14:41:22 +07:00
Yonle
da562a335d feat: Orphan Session
Add feature to keep and reuse an session to cut some loads off &
somewhat improve bouncing performance.

Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 14:10:01 +07:00
Yonle
6044eb2dba feat: add feature to only allow event from <approved_publishers>
Based on: https://github.com/Yonle/bostr/pull/8
Idea is originally by Takuro Furoda <https://github.com/ftkro>

This feature will only allow transmitting events from specified authors.

Suggested-by: Takuro Furoda
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-01 11:16:53 +07:00
Ryo Kanbayashi
99a076865b
several bug fixes (by ryogrid #7)
* condition of if statement at line 119 seems to wrong
* Original code can't check size of client.pendingEOSE.get(data[1]) collectly
* Replaced clearInterval to clearTimeout. canceling function for timer which is created by setTimeout is clearTimeout
2023-12-25 21:12:26 +07:00
Yonle
c400c3959d relayHandler: terminate immediately if user already disconnected.
Signed-off-by: Yonle <yonle@lecturify.net>
2023-12-24 21:22:56 +07:00
Yonle
c7d37b8531 PRfix: timeoutBeforeReconnHandler, and improvements in code
As based in the following Pull Request:
- https://github.com/Yonle/bostr/pull/6

Suggested-By: ryogrid <ryo.contact@gmail.com>
Signed-off-by: Yonle <yonle@lecturify.net>
2023-12-24 21:16:44 +07:00
Yonle
0c8d21edf1 typofix
Signed-off-by: Yonle <yonle@lecturify.net>
2023-12-20 18:37:24 +07:00
Yonle
1efe153039 ramp the cache up, again.
Signed-off-by: Yonle <yonle@lecturify.net>
2023-12-20 00:16:54 +07:00
Yonle
6b1c5e03eb ramp the cache up no matter what
Signed-off-by: Yonle <yonle@lecturify.net>
2023-12-20 00:11:13 +07:00
Yonle
635b317d73 caching: also save into cache relays
Signed-off-by: Yonle <yonle@lecturify.net>
2023-12-19 23:48:24 +07:00