mlctrez
72ef03f238
use crypto/rand instead of math/rand
2022-12-20 08:00:22 -03:00
fiatjaf
6c13dc7969
remove tlv from npub in nip19.
2022-12-19 15:10:23 -03:00
fiatjaf
b3aa4eba29
remove unused dependency.
v0.9.0
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
ad71e083d8
add some extra padding to decoy super small messages.
2022-12-14 16:17:37 -03:00
fiatjaf
8a8fd7c2b0
fix nip04 decryption padding and add tests.
2022-12-14 16:10:10 -03:00
fiatjaf
ac25c2071e
another event serialization test, now reversed.
2022-12-14 13:35:13 -03:00
fiatjaf
4a3aea6d4b
update nip04 to btcec/v2
2022-12-11 19:01:36 -03:00
fiatjaf
fb29445ef9
omitempty metadata fields.
2022-12-11 16:35:04 -03:00
fiatjaf
ea15550039
kind-0 metadata helper type.
2022-11-26 19:32:16 -03:00
fiatjaf
0c39530d57
QuerySync() relay method.
2022-11-26 19:32:03 -03:00
fiatjaf
e8bc11e4f9
support nip-35.
2022-11-26 19:31:49 -03:00
fiatjaf
2d01aa8630
prevent sending on closed channel for subscription.
v0.8.2
2022-11-26 09:25:51 -03:00
fiatjaf
67d8f26d8a
some stringifiers.
2022-11-26 09:25:31 -03:00
fiatjaf
b0ae497656
allow more fine-grained control over subscription filters.
2022-11-19 14:00:29 -03:00
fiatjaf
8bc91a894c
sub.GetFilters()
2022-11-19 07:19:36 -03:00
fiatjaf
b2885d57cd
fix blank case on NormalizeURL().
2022-11-19 07:19:10 -03:00
fiatjaf
89cb5ad461
fix Tag.Relay().
2022-11-18 14:18:37 -03:00
fiatjaf
e09f6b4bff
fix event extra: create a map when it doesn't exist.
2022-11-18 14:18:37 -03:00
fiatjaf
0d7a4b258a
fix normalize and add a test.
2022-11-18 14:18:37 -03:00
fiatjaf
37b3bf7a8a
helpers for dealing with extra values in events.
2022-11-17 10:58:45 -03:00
fiatjaf
480ee0ef87
PublishEvent() fixes.
2022-11-17 09:28:45 -03:00
fiatjaf
381ee2cc01
tag helpers in a separate file and nip10 helpers.
2022-11-17 09:19:55 -03:00
fiatjaf
69ccfbaa08
protect against faulty relays that send more than one EOSE halting us
...
using sync.Once{} to only emit to the EndOfStoredEvents channel once
(it has capacity 1 so anything over that would halt).
2022-11-16 10:07:37 -03:00
fiatjaf
7538f1108d
stop halting at EOSE.
2022-11-16 10:05:28 -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
2ec7957409
fix nip19 bech32 encoding and decoding.
2022-11-15 16:29:37 -03:00
fiatjaf
dd0571229b
RelayConnect() ensures there will be a connection, and handle connection errors better.
v0.8.1
2022-11-15 07:53:50 -03:00
fiatjaf
2b8807d699
fix relay .Connect() and .Sub()
2022-11-14 19:48:02 -03:00
fiatjaf
37235a1394
bring back unique events.
2022-11-13 19:33:48 -03:00
fiatjaf
2641327c28
support for EOSE and OK messages on relay/subscription.
2022-11-12 21:49:57 -03:00
fiatjaf
50e47392a9
improve tags godoc.
2022-11-11 10:56:17 -03:00
fiatjaf
8a12bb2c18
some helper functions for tags.
v0.8.0
2022-11-11 10:52:23 -03:00
Blake Jakopovic
cdc9b61db1
Update example.go
...
Fixed a typo and capitalised
2022-11-09 13:20:18 -03:00
fiatjaf
fe01c9474b
fix string formatting on test errors.
2022-11-08 08:44:22 -03:00
fiatjaf
f98f54d3be
use generic functions for dealing with lists.
2022-11-08 07:15:08 -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
2427dbd65a
rename to github.com/nbd-wtf/go-nostr
2022-11-04 08:24:32 -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
fiatjaf
3a6d6795e4
add an "extra" map to events that can be used to merge other properties when necessary.
2022-11-04 08:21:35 -03:00
fiatjaf
fb3972b725
add new event kinds.
2022-11-04 08:03:17 -03:00
fiatjaf
7de8bcd2d0
basic support for nip19.
2022-10-31 14:57:49 -03:00
BitcoinCoderBob
9549c3624a
nostr package, readme updates accordingly, matching example program ( #14 )
2022-10-12 17:24:30 -03:00
dolcea@lenovo
e47c80a63d
Handle Filter.Limit
2022-10-11 13:58:29 -03:00
Santos Hernandez
e546214291
added nbd badge
2022-10-07 18:51:36 -07:00
Santos Hernandez
5276359774
Rename LICENSE to LICENSE.md
2022-10-07 16:52:01 -07:00
Santos Hernandez
01a4034add
Create LICENSE
2022-10-07 16:51:17 -07: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
v0.7.5
2022-08-22 08:45:39 -03:00
fiatjaf
2f84ddf5f5
add limit field to filter.
v0.7.4
2022-07-24 19:53:10 -03:00
fiatjaf
66aa4e9de2
add nip-11 type.
v0.7.3
2022-07-11 15:51:24 -03:00