Yonle
3d1f325e48
worker: worker.ref(). don't let worker die.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-06-05 20:09:10 +07:00
Yonle
30fd601263
code: use .close() instead of .terminate() & change the name for node module load
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-06-05 19:57:17 +07:00
Yonle
1df2ad13db
config: max_conn_per_ip for limiting maximum incomming connections per IP.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-19 23:12:44 +07:00
Yonle
55cd043b6e
bouncer.js: try not send another AUTH after rejecting request due to unauthorized access
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-16 19:36:17 +07:00
Yonle
1a3bac81b5
code: internal auth handling: improve the way of how it works
...
- Try not to renew ${authKey} variable after auth
- Call _auth() only after ${authenticated} and ${!sessStarted} is passed
(_auth() is for telling the worker thread the authenticated user
pubkey)
- In worker_bouncer.js, If csess[m.id].pubkey === m.pubkey, We do not
need to do another reAUTH to these relays.
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-16 18:45:55 +07:00
Yonle
8665374a66
fix authorized_keys don't work on npub string & make private_keys accept npub string
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-16 18:34:07 +07:00
Yonle
dc96f87515
code comments: remove some old comments and try improve some existing one
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-12 16:07:38 +07:00
Yonle
c8dfe77fc8
bouncer: forgot to tell the ident that worker should delete
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-11 13:12:39 +07:00
Yonle
62c79c1180
bouncer: bugfix of EVENT write did not work due to lack of allowed_publishers check.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-11 11:35:09 +07:00
Yonle
e8c5abedfd
bouncer: just don't leave every single orphan unresolved Promises being lonely in memory
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-11 11:19:00 +07:00
Yonle
bd425a9e5a
bouncer: just poke ready function if session is already prepared
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-11 11:01:53 +07:00
Yonle
bc4784bfe0
bouncer: improve session & idents handling
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-11 10:59:10 +07:00
Yonle
8fc6c71d8e
bouncer: try set sessStarted = true first
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-11 10:24:59 +07:00
Yonle
4923d263f2
code cleaning and features removal
...
The following configurations is removed due to flawed memory issues:
- broadcast_ratelimit
- incomming_ratelimit
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-11 10:19:27 +07:00
Yonle
b6af5af30b
code: replace Map() with Object just to try busting the myth
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-10 18:35:05 +07:00
Yonle
f6baf0c53b
bouncer: split code into two separate processes with upstream comms to be a worker
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-05-10 13:18:05 +07:00
Yonle
a3ae67a2c4
bouncer: improve NIP-42 compatibilities
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-28 21:20:25 +07:00
Yonle
07bca8d9cf
feat: bouncer load balancer
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-28 21:01:58 +07:00
Yonle
97e6293150
try to improve handling EOSE for cached relays
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-23 19:54:44 +07:00
Yonle
1c20de4587
nostr-tools being randomly throw error in their own code. Put safety.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-16 02:25:10 +07:00
Yonle
14fe204fb7
for statistic, CLOSED may only counts when the closing reason has value in it
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-10 15:19:35 +07:00
Yonle
7417f23fd5
statistic: add raw_rx
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-06 14:38:06 +07:00
Yonle
19cc63cc81
bouncer: warn when config is still using approved_publishers
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-05 14:24:45 +07:00
Yonle
d8b2a8388b
bouncer: count fail for unexpected status code too.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-05 10:30:18 +07:00
Yonle
83dc69bfd7
bouncer: fix ratelimit & stats handling
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-04 21:52:10 +07:00
Yonle
e9f79114d0
bouncer: forget to put rx into global statistics.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-04 21:37:58 +07:00
Yonle
63a404d3ae
feat: add bouncer statistics
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-04-04 21:33:11 +07:00
Yonle
427777307a
bouncer: fixbug on handling invalid relay response
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-29 07:58:20 +07:00
Yonle
5a95821cc9
bouncer: change code on variable names, and handling iterate from relays instead of doing .forEach
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-28 22:13:24 +07:00
Yonle
d3eeb37717
bouncer: fix pendingEOSE being deleted before all relays sends EOSE
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-28 08:33:44 +07:00
Yonle
2972624c49
bouncer & defaultconf: change nobot to noscraper
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-27 23:23:53 +07:00
Yonle
dfdc5fbcc4
bouncer: if nobot is being set, don't perform request for bot/scraper/crawler/similiar.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-27 23:15:16 +07:00
Yonle
be9b0698b8
bouncer: override opened subscription when requested.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-23 13:38:54 +07:00
Yonle
4afe82b342
bouncer: just slam EOSE from cache relay. idc
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-23 12:06:41 +07:00
Yonle
9d07840f67
bouncer: skip check if same event already transmitted & only store to cache relay if not received before
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-23 11:55:14 +07:00
Yonle
6d9987486e
bouncer: add caching feature back.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-22 23:54:37 +07:00
Yonle
7fa955dc25
bouncer: fix multiple EOSE being sent when received very new event.
2024-03-21 22:20:16 +07:00
Yonle
db0c88a2b7
bouncer: log info about OK, NOTICE, and CLOSED message when log_about_relays is true
2024-03-21 22:12:31 +07:00
Yonle
ae3f5888c2
bouncer: fix multiple EOSE bypassing when using save mode.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-21 17:54:22 +07:00
Yonle
948207806d
feat(bouncer): add option for adjusting numbers of idle sessions.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-18 23:57:53 +07:00
Yonle
b0b3d98c9e
log: tell to logger if an IP is now known as something.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-18 22:51:32 +07:00
Yonle
99dc6bc6a2
fix bug on idle connection closing.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-18 22:51:32 +07:00
Yonle
d6cfdcb6ad
try to make idle session and wait for a client to take over it
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-18 22:51:32 +07:00
Yonle
f80f78bb95
Revert "bouncer: rehandle how handling EOSE works."
...
This reverts commit 20aab1a79c881597030802769d1fde21f88d7fb9.
2024-03-12 17:37:12 +07:00
Yonle
148ae31b47
Revert "bouncer: try use Set() for connectedRelays counting instead."
...
This reverts commit 2bf91f8603485710bcf81324eb5338bc0f1bfe9f.
2024-03-12 17:37:06 +07:00
Yonle
2bf91f8603
bouncer: try use Set() for connectedRelays counting instead.
2024-03-10 08:50:18 +07:00
Yonle
20aab1a79c
bouncer: rehandle how handling EOSE works.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-10 08:13:42 +07:00
Yonle
348830c577
bouncer: absurd harmless bug that does not harm anyone but technically annoying
...
As it turns out, private_keys !== {} is not enough.
When i do some experiment in Node.js REPL to find out the cause why the
heck bouncer.js still sends AUTH to user even with private_keys being
empty ({}), This absurd result happens:
Welcome to Node.js v20.11.1.
Type ".help" for more information.
> {} === {}
false
> {} !== {}
true
> {} != {}
true
> {} == {}
false
What the fuck..
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-02 18:07:30 +07:00
Yonle
f148914ed8
bouncer: handle error on missing config field for blocked_publishers
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-03-02 17:42:02 +07:00
Yonle
67f16ff247
feat(bouncer): Tell upstream relays the client IP address if needed.
...
Signed-off-by: Yonle <yonle@lecturify.net>
2024-02-28 22:49:23 +07:00