148 Commits

Author SHA1 Message Date
Yonle
a0ec8bd2bc bouncer: do not keep unauthorized session.
Signed-off-by: Yonle <yonle@lecturify.net>
2.0.4
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
594fe63805 Release 2.0.4
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-24 16:25:51 +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
9ed79a0892 fix strict syntax on http.js
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-23 21:25:56 +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
120198d195 code improvement after PR #11
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-13 18:53:59 +07:00
Takuro Fukuda
7970d00132
Standalone HTTPS support (#11) 2024-01-13 18:36:24 +07:00
Yonle
94d0e10eb2 http.js: Tell explicitly whenever client was connecting with https or http.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-09 23:26:18 +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>
2.0.3
2024-01-05 00:14:26 +07:00
Yonle
d20cab9548 defaultconf: leave ratelimit disabled by default.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-05 00:06: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
e35b1ac584 autoclear lastConn
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 22:15:50 +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
a78d8370ec Release: 2.0.3
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-04 14:26:55 +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>
2.0.2
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
403c51c9ee Release: 2.0.2
Fast connect and disconnecting is brutal sometime.

What's new?
===========
- An whitelist to only allow some event authors to be published with
  this bouncer.
- Orphan sockets feature to make stuff fast & not so easy to abuse,
  therefore reducing the amount of reconnects.

New Contributors
================
- Takuro Fukuda https://github.com/ftkro

Full Changelog: https://github.com/Yonle/bostr/compare/2.0.1...2.0.2

Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 17:32:10 +07:00
Yonle
80d87626fd defaultconf: enable orphan session by default
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 17:24:53 +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
7df3a272af orphan socket is unreliable.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-03 14:23:59 +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
08684cfdbd defaultconf: leave pause_on_limit off by default
Signed-off-by: Yonle <yonle@lecturify.net>
2024-01-01 18:42:55 +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
Yonle
a163e6a879 defaultconf: change default max_eose_score
Signed-off-by: Yonle <yonle@lecturify.net>
2023-12-28 08:38:00 +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
2.0.1
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