58 Commits

Author SHA1 Message Date
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
fiatjaf
b33cfb19fa rename option pool.WithQueryMiddleware() to pool.WithAuthorKindQueryMiddleware(). 2025-01-03 00:12:34 -03:00
fiatjaf
95ddacb9f3 sdk: track query attempts automatically and other small tweaks to replaceable fetching and stuff. 2024-12-24 00:15:10 -03:00
fiatjaf
529ade9376 nip45: hyperlolog small fixes and improvements. support deterministic offset for hardcoded set of queries. 2024-12-07 00:12:43 -03:00
fiatjaf
0d40b40c9c pool: support CountMany() using hyperloglog. 2024-11-16 17:47:42 -03:00
fiatjaf
28b05cdd9b SimplePool.PublishMany(), finally. 2024-10-18 07:08:15 -03:00
fiatjaf
47d493b7e8 make libsecp256k1 available with a build tag. 2024-09-27 17:45:46 -03:00
fiatjaf
0caf8deb56 WithUserAgent() pool option. 2024-09-26 19:18:34 -03:00
fiatjaf
1b786ab213 take subscription options in pool.SubMany* 2024-09-24 12:05:28 -03:00
fiatjaf
8327310d52 improve SimplePool authHandler, rename IncomingEvent to RelayEvent so we can use it there. 2024-09-19 12:28:42 -03:00
fiatjaf
64c6057c08 return from subMany() on context done in one place where we weren't. 2024-09-11 21:05:34 -03:00
fiatjaf
077c14cef6 pool: implement optional penalty box mechanic. 2024-07-29 14:58:53 -03:00
fiatjaf
6ed112cc69 pool event middleware for optionally doing stuff with all events. 2024-06-27 16:49:50 -03:00
fiatjaf
d06f61136d allow using libsecp256k1 for signature verification in subscriptions. 2024-05-29 17:08:15 -03:00
fiatjaf
0836352724 namedLock() uses normalized uri and a simple test. 2024-05-29 08:39:49 -03:00
fiatjaf
96da8bd6f5 IncomingEvent.String() 2024-05-22 08:49:46 -03:00
fiatjaf
ced14c09ac pool: simplify batches (extra code was actually doing nothing at all). 2024-02-25 11:22:30 -03:00
fiatjaf
e6ef78c509 DirectedFilters to accept a list of filters. 2024-02-24 18:51:56 -03:00
fiatjaf
28b34794f4 pool.BatchedSubMany() 2024-02-24 18:44:37 -03:00
fiatjaf
9c4ea87d0b
use stdlib "slices". 2024-02-08 16:33:39 -03:00
fiatjaf
1a7b8991a3
pool: deduplicate relay urls list. 2024-01-18 11:49:16 -03:00
fiatjaf
7b292775c0
migrate to xsync/v3
closes https://github.com/nbd-wtf/go-nostr/issues/117
2024-01-10 06:54:53 -03:00
fiatjaf
2f514d5026
remove unnecessary mutex. 2023-12-15 14:15:37 -03:00
Yasuhiro Matsumoto
242af0bf76 fix heavy loop 2023-12-14 16:07:46 -03:00
fiatjaf
3e1749a01d
fix OK handling. 2023-12-09 13:21:35 -03:00
fiatjaf
b2170efb5a
support performing AUTH in the middle of SimplePool's subMany* 2023-12-07 21:37:41 -03:00
fiatjaf
15f026d2c5
exponential backoff on SimplePool reconnections and only update since once. 2023-12-02 15:12:45 -03:00
fiatjaf
0e0ecb2412
refactor SimplePool automatic reconnection. 2023-12-02 14:59:16 -03:00
fiatjaf
32c1969397
simplify pre-eose cleanup in pool.subMany() 2023-12-02 14:37:32 -03:00
Yasuhiro Matsumoto
cb8b40bd00 reconnect 2023-12-02 14:36:16 -03:00
fiatjaf
c606a43c07
fix atrocious bug on pool.subMany(): we were missing events because of a badly designed select{} 2023-12-01 20:49:45 -03:00
fiatjaf
711db062a1
primitive support for CLOSED in SimplePool. 2023-12-01 13:37:24 -03:00
Yasuhiro Matsumoto
cd0d644046 If EOSE is not given, they should not be deleted. 2023-11-24 10:33:08 -03:00
Yasuhiro Matsumoto
ba25770f65 seenAlready must drop older events 2023-11-24 10:33:08 -03:00
fiatjaf
307df51b9a
use xsync maps for pool relays to prevent concurrent access panics. 2023-11-16 14:51:33 -03:00
fiatjaf
15b3aebc86
fix an accidental API breaking change. 2023-10-08 14:46:16 -03:00
fiatjaf
edefc57b28
clear context differentiation on submany/unique. 2023-10-03 15:43:18 -03:00
fiatjaf
7d1091b66b
fix a stupid bool. 2023-10-02 14:46:19 -03:00
fiatjaf
e45921c11a
pool.SubMany(Eose)NonUnique() 2023-10-02 14:16:16 -03:00
fiatjaf
978d7825b5
return IncomingEvent struct from SimplePool methods containing the relay. 2023-09-30 19:16:30 -03:00
fiatjaf
18cee7421a
fix xsync counter initialization. 2023-09-16 07:51:44 -03:00
fiatjaf
eef7c40dc7
migrate to xsync v2. 2023-09-04 16:44:36 -03:00
fiatjaf
5a51f84433
pool.QuerySingle() 2023-08-06 19:57:08 -03:00
fiatjaf
b522d24c30
use a named lock instead of a single per-pool mutex. 2023-08-06 19:54:30 -03:00
fiatjaf
6cee628149
rename debugLog->debugLogf 2023-07-11 15:25:02 -03:00
fiatjaf
82a51f149a
prevent halting on SubManyEose. 2023-07-08 08:15:34 -03:00
fiatjaf
030c1d1898
get rid of mutexes and use a single loop to prevent races.
in the meantime change the API to makes a little less error-prone.
2023-06-21 19:55:43 -03:00