fiatjaf
515f76bd86
add a default user-agent: github.com/nbd-wtf/go-nostr.
...
fixes https://github.com/nbd-wtf/go-nostr/issues/147
2024-09-16 07:11:19 -03:00
fiatjaf
a094f3a9d2
negentropy.
...
- a way to handle custom messages from Relay (NEG-whatever etc)
- negentropy implementation (adapted from that other one)
- nip77 nostr negentropy extension
- QueryEvents method for RelayStore that returns a channel (makes negentropy syncing work more seamlessly)
2024-09-14 07:40:09 -03:00
fiatjaf
9addd57db7
missing bit from f57d93.
2024-09-11 10:16:28 -03:00
fiatjaf
f57d93ac78
after getting an EOSE we should stop checking since/until.
2024-09-06 19:37:34 -03:00
fiatjaf
51e527680e
WithNoticeHandler() just calls a function, no channel stuff anymore.
...
probably fixes https://t.me/nostr_protocol/145832
I think we were using this channel for legacy reasons, it feels completely unnecessary now.
2024-08-31 23:12:20 -03:00
fiatjaf
a7303c385b
error instead of panic'ing when opening subscription.
2024-06-27 14:50:24 -03:00
fiatjaf
a35cdff6c8
problem: connection can be nil when writing and we're panic'ing.
2024-06-21 09:32:53 -03:00
fiatjaf
37ef70e4cb
relay: prevent panic on double-closing.
...
probably fixes https://github.com/nbd-wtf/go-nostr/issues/130
2024-06-19 09:59:28 -03:00
fiatjaf
d06f61136d
allow using libsecp256k1 for signature verification in subscriptions.
2024-05-29 17:08:15 -03:00
ice-cronus
c0f1c4f510
add option to connect with custom TLS
2024-03-28 15:54:12 -03:00
fiatjaf
09ea5d5758
subscription.EndOfStoredEvents to have a capacity of 1 so it never gets deadlocked.
2024-01-28 14:34:05 -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
3e1749a01d
fix OK handling.
2023-12-09 13:21:35 -03:00
fiatjaf
f8fa490293
get rid of PublishStatus
and always expect relays to answer with an OK for both AUTH and EvENT publishes.
2023-12-07 21:31:40 -03:00
fiatjaf
3adb1cde3c
only store the last AUTH challenge and allow user to perform auth only whenever they want instead of automatically.
2023-11-28 22:30:16 -03:00
fiatjaf
7449f254db
support handling CLOSED messages from relay client.
2023-11-28 18:54:24 -03:00
fiatjaf
93b43ed426
add infolog for when a relay sends an unexpected OK message.
...
this can be indicative of either us or the relay miscalculating the event id.
2023-11-08 22:22:30 -03:00
fiatjaf
c357e6babe
log event id on bad signature.
2023-11-08 00:07:01 -03:00
fiatjaf
f6df0f3f40
rename .mu -> .closeMutex
2023-11-05 13:39:09 -03:00
Yasuhiro Matsumoto
20d65d4a76
fix race condition in Close
2023-11-05 13:38:32 -03:00
fiatjaf
f8fb9e8c26
fix OKEnvelope always requiring the 4th field.
2023-11-04 17:30:19 -03:00
Isaque Veras
0f66883dc7
feat(kind): using constants
2023-09-07 07:05:01 -03:00
fiatjaf
eef7c40dc7
migrate to xsync v2.
2023-09-04 16:44:36 -03:00
fiatjaf
1f605f3629
remove intermediary .events channel and hacky ms sleep.
2023-09-04 08:57:53 -03:00
fiatjaf
6d1875de46
ensure eose channel closes after events have been emitted.
2023-09-04 08:33:31 -03:00
fiatjaf
4c50cce79c
add the same warnings in Subscribe and PrepareSubscription help comments.
2023-08-31 09:27:20 -03:00
fiatjaf
446b104990
simplify subscription closing.
2023-08-22 10:58:34 -03:00
Kay
ac2350c722
style: using effective go and refactoring
2023-08-21 15:50:05 -03:00
fiatjaf
35faff858a
reuse buffer when reading messages from websocket.
2023-07-30 17:12:30 -03:00
fiatjaf
53b9dde6e0
relay.Count()
2023-07-18 16:17:00 -03:00
fiatjaf
6cee628149
rename debugLog->debugLogf
2023-07-11 15:25:02 -03:00
fiatjaf
c03c028142
fix: don't stop reading the websocket for no reason!
2023-07-11 15:23:48 -03:00
fiatjaf
6e79f72174
prevent halting in some other places.
2023-07-11 11:04:48 -03:00
fiatjaf
6b625f7896
handle OK callbacks properly when there is not a "reason" (which is the expected behavior).
2023-06-26 21:00:39 -03:00
fiatjaf
54d3de4908
refactor some things, add back one mutex for each subscription for dispatching events, but in a cleaner way.
2023-06-25 00:17:39 -03:00
fiatjaf
ac0c0769fe
disentangle things a little more.
...
having a single loop for everything was too much. goroutines things were getting stuck.
2023-06-23 16:23:00 -03:00
fiatjaf
f0a35d7ab2
Write returns an error in a channel (why? I think it makes no difference.)
2023-06-22 10:46:31 -03:00
fiatjaf
f78270765d
prevent halting when a relay gets disconnected.
2023-06-22 10:45:45 -03:00
fiatjaf
fd409f6c35
add closure queue channel that was missing.
2023-06-22 09:32:12 -03:00
fiatjaf
68648a16b9
remove conn field from subscription.
2023-06-22 09:12:35 -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
fiatjaf
ee8f58360f
print all filters when doesn't match.
2023-06-09 16:11:16 -03:00
fiatjaf
a80965425b
comment out info log for when we get an event outside of a subscription.
...
relays will often keep sending stored events even though we've closed a subscription already.
2023-06-09 13:49:29 -03:00
fiatjaf
bc783a3a24
fix atomicity of subscription ids.
2023-06-09 11:01:42 -03:00
fiatjaf
9cafea7e2a
ensure relay context and subscriptions are closed when we lose connectivity.
2023-05-30 17:44:25 -03:00
fiatjaf
a2941876e3
expose subscriptions from relay and keep that updated.
2023-05-30 14:55:44 -03:00
fiatjaf
0f7a3f01f2
use an atomic counter.
2023-05-30 14:01:07 -03:00
fiatjaf
39f09e6bb9
replace generic-sync-map with xsync.
2023-05-30 13:52:14 -03:00
fiatjaf
ad0f73fa9c
ensure subscription dies if the relay connection dies.
2023-05-30 13:47:47 -03:00
fiatjaf
5cead32fbe
remove extra subscription after publishing an event to check if it is there.
...
just assume all relays will return OK.
2023-05-30 13:45:45 -03:00