Commit Graph

20 Commits

Author SHA1 Message Date
fiatjaf 480ee0ef87 PublishEvent() fixes. 2022-11-17 09:28:45 -03:00
fiatjaf 14e81a756a fix unique logic (move it to a helper function, we can't return two channels because that will break if the caller doesn't read from both.) 2022-11-15 16:40:17 -03:00
fiatjaf dd0571229b RelayConnect() ensures there will be a connection, and handle connection errors better. 2022-11-15 07:53:50 -03:00
fiatjaf 37235a1394 bring back unique events. 2022-11-13 19:33:48 -03:00
fiatjaf c4d52e516f change relaypool and subscription such that a Relay can have an independent existence. 2022-11-06 21:15:42 -03:00
fiatjaf 329b8d44d2 move stuff back from nostr package to top level.
because otherwise the path must be specified as github.com/fiatjaf/go-nostr/nostr, which is annoying.
2022-11-04 08:22:13 -03:00
BitcoinCoderBob 9549c3624a nostr package, readme updates accordingly, matching example program (#14) 2022-10-12 17:24:30 -03:00
fiatjaf cea3004867 update to go1.18 and use generic sync maps instead of normal maps.
fixes https://github.com/fiatjaf/go-nostr/issues/12
2022-08-22 08:45:39 -03:00
fiatjaf 1f1d3cfe7f some changes and fixes related to sub.Sub(). 2022-05-04 12:39:10 -03:00
fiatjaf 5d1a29d135 stop closing publishstatus connection and subscriptions.
I'm not sure about this but it seems to work better this way.
2022-05-01 21:11:46 -03:00
fiatjaf 16c874cb8d add String() method to Status int on PublishStatus. 2022-05-01 17:51:46 -03:00
fiatjaf a11aa8756b fix CheckSignature(): we were parsing the pubkey with the ECDSA function instead of Schnorr. 2022-05-01 17:51:16 -03:00
fiatjaf 00ad1acde9 use schnorr from btcec instead of the bip340 library. 2022-05-01 15:10:18 -03:00
Gustavo Chain c0a2be91a1 relaypool: continue on ping msg 2022-02-19 08:33:29 -03:00
fiatjaf 86853004ef change parsing so NIP12 can work, rename types. 2022-02-08 16:27:33 -03:00
fiatjaf ef1f548212 avoid sending to closed Events/UniqueEvents channels. 2022-02-07 11:33:45 -03:00
Honza Pokorny a3df2cb893 Add mutexes around websockets
We replace the bare websocket.Conn type with a new Connection type which
implements `WriteJSON`, `WriteMessage`, and `Close`.  The Connection
type adds mutexes around writes since gorilla doesn't support concurrent
writes to websockets.

Signed-off-by: Honza Pokorny <honza@pokorny.ca>
2022-01-12 12:19:33 -03:00
Honza Pokorny 26c3b4aac9 Remove unnecessary argument to subscription.Sub
The `Sub()` function retrieves the list of filters from the
`Subscripton` object itself, and therefore it's unnecessary to pass it
in.  The argument is unused.

Here, we remove the function argument from the definition, and from the
single call site.  We then pass the filters to the initializer.

This makes it so that filters are in fact passed to the relay on the wire.
2022-01-04 12:24:05 -03:00
fiatjaf 140edc693c relay policies as interfaces, SimplePolicy as the most basic implementation. 2022-01-02 08:50:53 -03:00
fiatjaf d131e8460e move everything to the same directory. 2022-01-02 08:44:18 -03:00