Commit Graph

170 Commits

Author SHA1 Message Date
fiatjaf 4348c64b14 r.writeQueue doesn't have to be closed. 2026-03-08 22:58:36 -03:00
fiatjaf 1d14e6bebe relay: fix inverted r.writeQueue check. 2026-03-04 00:01:04 -03:00
fiatjaf 23d525f067 another last guard against sending on closed channel. 2026-03-02 11:59:12 -03:00
fiatjaf 4dab261bdf close relays when sending a CLOSE message fails and ensure closed relays aren't used. 2026-03-01 09:44:53 -03:00
fiatjaf 44c429d6b1 ensure we fail subscriptions to closed relays. 2026-03-01 09:26:00 -03:00
fiatjaf 4b5c51ffc0 refactor unsub to be dependent on the context only and always. 2026-03-01 09:19:25 -03:00
fiatjaf 5de9501556 fixes. 2026-03-01 09:18:55 -03:00
fiatjaf 1df85217d9 merge connection into relay, do all the closing logic on context cancelation and have closeMutex be a channelmutex. 2026-02-28 14:19:57 -03:00
fiatjaf 195cb944e2 fix potential subscription leaking bug with MaxWaitForEOSE never being effective. 2026-02-27 06:47:27 -03:00
fiatjaf c31b92707b trying to prevent leaking subscriptions. 2026-02-26 23:01:18 -03:00
fiatjaf e17995d427 authHandler bugfix from ben at nostr:nevent1qqsy9nka36av9ukvkyq42626t7gkyu4rdkgsu0c785kprup3a2694ngkkwvrk 2026-02-01 16:52:53 -03:00
fiatjaf 5efcbbfddb relay options passed to pool should take the relay sometimes. 2026-01-11 17:47:32 -03:00
fiatjaf 3335c29389 relay: auth handler; pool: rename auth handler. 2026-01-08 18:54:19 -03:00
fiatjaf 97424e363a allow using a custom http client.
fixes nostr:nevent1qvzqqqqx25pzqm8ksn7p6aak225sed38vlzngtuwl50tf0e8ahzuzkhpmuahzgzdqyd8wumn8ghj7cmpvd5x2v3wwpexjmtpdshxuet59amrzqg4waehxw309aex2mrp0yhxgctdw4eju6t09uqzq8r9r4par63whq6px0af5uxtkkx0psydtamq6rdcva248l27l2szensns3
2025-12-18 12:03:42 -03:00
fiatjaf c20ca669cd nip77: more interface fixes to prevent channel deadlock. 2025-11-13 16:12:10 -03:00
fiatjaf c2ab9d082c *connection to be an integral part of *Relay. 2025-11-12 09:47:26 -03:00
fiatjaf 1c43f0d666 relay wasn't taking CustomHandler and NoticeHandler from options. 2025-11-11 23:49:00 -03:00
fiatjaf e1fbd09407 fix iterator cancelation in relay.QueryEvents() 2025-10-17 19:32:23 -03:00
fiatjaf b67e3092b0 release a goroutine that could leak in some conditions. 2025-09-07 19:01:43 -03:00
fiatjaf 80d0546ce6 we should be doing this since years ago: force an EOSE if the relay refuses to give us one. 2025-08-25 22:42:05 -03:00
fiatjaf 69c0981b51 address closeMutex deadlock by canceling the relay connection context on doClose(). 2025-08-23 10:08:45 -03:00
fiatjaf 31a590ee4f fix sending on close channel with yet another mutex. 2025-08-23 09:16:12 -03:00
fiatjaf 5d42b2f857 nest okcallbacks so they're called one by one. 2025-08-06 15:13:55 -03:00
fiatjaf 83c34daa8b OK callbacks that still work even if the same event is published twice. 2025-07-30 15:06:30 -03:00
fiatjaf 6592319774 stop exposing connection, more debugLog calls and properly fail subscriptions when a relay dies. 2025-07-13 14:21:15 -03:00
fiatjaf 9f8b810882 fix main relay context being canceled instead of just the dial context. 2025-07-11 13:01:04 -03:00
fiatjaf 7289da9c72 improve/refactor websocket connections hoping this will fix the undetected disconnections we're seeing.
this commit also remove all the sonic envelope parsing and reintroduces filters in REQ as a slice instead of as a singleton.

why? well, the sonic stuff wasn't really that fast, it was a little bit but only got fast enough once I introduced unsafe conversions between []byte and string and did weird unsafe reuse of []byte in order to save the values of tags, which would definitely cause issues in the future if the caller wasn't aware of it (and even if they were, like myself).

and the filters stuff is because we abandoned the idea of changing NIP-01 to only accept one filter per REQ.
2025-07-10 22:58:37 -03:00
fiatjaf 28f85c9ea3 fix sending request header. 2025-05-30 10:09:03 -03:00
pippellia-btc 0853405c03 probably fixing race condition. 2025-05-07 10:34:05 -03:00
fiatjaf 15c6093c9b define a nostr.Kind type for event kinds, make adjustments everywhere and fix some horrible bugs with mmm, lmdb and badger querying and deleting. 2025-04-20 11:15:41 -03:00
fiatjaf f7884cea4f wait, Querier can just return an iter like eventstore, it's ok. 2025-04-16 03:06:27 -03:00
fiatjaf 5b8954461f it never ends. 2025-04-16 02:59:47 -03:00
fiatjaf 2b5b646a62 a big bundle of conversions and other changes. 2025-04-15 17:13:57 -03:00
fiatjaf b4268d649c a bunch of [32]byte conversions. still more needed. 2025-04-14 17:47:53 -03:00
fiatjaf dad99b226c relay: fix unsafe overwriting of event buffer that affected parsed pubkeys, ids, content. 2025-04-07 15:56:36 -03:00
fiatjaf cc23d81e80 pool's .FetchManyReplaceable() and amends to previous commit. 2025-03-12 00:49:58 -03:00
fiatjaf 441f94563f WithCheckDuplicateReplaceable() and helper functions for efficient replaceable event matching. 2025-03-12 00:19:41 -03:00
fiatjaf cecc71cd81 fix and improve envelope stuff again, deal with messages as strings on all envelope parsing steps. 2025-03-12 00:18:11 -03:00
fiatjaf 5bfaed2740 docstrings for many functions. 2025-03-04 11:42:44 -03:00
fiatjaf 17431dee59 do not close relay connection when ping fails because some relays just do not pong. 2025-01-25 00:26:38 -03:00
fiatjaf 3e1c0ddc7e fix pinging relays: use the main relay context, not the relay connection temporary context. 2025-01-17 14:08:54 -03:00
fiatjaf 06a15fdaab follow list fetching test and related changes and fixes.
- make BatchedSubManyEose() use a single duplicate id index and use it for replaceable loaders;
- fixes parsing follow entry from kind:3 events (and others);
- adds a "cause" to most cancelation errors in relay/pool;
- remove the inherent cache from dataloader (we have our own hopefully);
- increase max frame size we can read from any websocket to 2**18 (262k), which gives over 2000 item lists.
2025-01-17 13:44:51 -03:00
fiatjaf febf022124 add some basic sdk tests, fix saving hints (normalize urls), checkduplicates arg order, kvdb stuff and other things. 2025-01-16 17:39:16 -03:00
fiatjaf e1971d12c0 WithCheckDuplicate(), let's see if this works. 2025-01-15 14:29:38 -03:00
fiatjaf 795f9516ae use @mmalmi json string preparsing speedup for duplicate events
- get rid of "nonUnique" variants of subMany as we can now relay on CheckDuplicate to track relays.
- add global pool tracker duplicateMiddleware.
2025-01-15 14:29:38 -03:00
fiatjaf defc349e57 use coder/websocket for everything, get rid of gobwas.
supposedly it is faster, and anyway it's better to use it since we're already using it for wasm/js.

(previously named nhooyr/websocket).
2025-01-03 01:15:17 -03:00
reis 63919cf685 support wasm (#163) 2025-01-02 09:42:04 -03:00
fiatjaf f22d4b7692 make it clear that a message was _received_ from a given relay on log output. 2024-12-17 11:06:36 -03:00
fiatjaf 1106329c95 return hyperloglog value from Relay.Count() 2024-12-10 23:24:45 -03:00
fiatjaf 851116d2e3 Merge branch 'hyperloglog' 2024-12-07 00:13:23 -03:00