16 Commits

Author SHA1 Message Date
fiatjaf
304b0a0477
use gobwas/ws instead now. 2023-04-07 07:37:34 -03:00
fiatjaf
f4454c1bb3
replace gorilla websockets with nhooyr.io 2023-04-06 17:41:42 -03:00
fiatjaf
35875e6071
replace vendored bech32 code with btcd library. 2023-03-23 16:59:46 -03:00
fiatjaf
b3aa4eba29
remove unused dependency. 2022-12-18 06:37:54 -03:00
alex
c327f622f3 relay: introduce ConnectContext for better control over network latency
A websocket dial may hand for an unreasonably long time and a nostr client
has no control over this when trying to connect to a relay.

Go started introducing context in networking since 2014 -
see https://go.dev/blog/context - and by now many net functions have
XxxContext equivalent, such as DialContext.

Example usage of the change introduced by this commit:

    ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
    defer cancel()
    r, err := nostr.RelayConnectContext(ctx, "ws://relay.example.org")

The code above makes RelayConnectContext last at most 3 sec, returning
an error if a connection cannot be established in the given time.
This helps whenever a tight control over connection latency is required,
such as distributed systems.

The change is backwards-compatible except the case where RelayPool.Add
sent an error over the returned channel without actually closing said
channel. I believe it was a bug.
2022-12-17 22:33:05 -03:00
fiatjaf
f98f54d3be
use generic functions for dealing with lists. 2022-11-08 07:15:08 -03:00
fiatjaf
2427dbd65a
rename to github.com/nbd-wtf/go-nostr 2022-11-04 08:24:32 -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
00ad1acde9 use schnorr from btcec instead of the bip340 library. 2022-05-01 15:10:18 -03:00
fiatjaf
41955a0601 serialization tests for events and filters. 2022-02-09 13:40:26 -03:00
fiatjaf
86853004ef change parsing so NIP12 can work, rename types. 2022-02-08 16:27:33 -03:00
fiatjaf
ba0507cce7 nip06 package for key derivation. 2022-01-06 21:57:04 -03:00
fiatjaf
275020a7ef just some basic bip340 key functions instead. 2022-01-06 08:24:20 -03:00
Honza Pokorny
8558025305 Add key-related functions 2022-01-06 07:39:04 -03:00
fiatjaf
0a60285e30 upgrade interfaces, add local filtering for subscriptions and some other things I forgot. also a README with examples. 2021-12-16 20:47:53 -03:00
fiatjaf
32c21eb652 basic event and relaypool. 2021-01-31 11:05:09 -03:00