Commit Graph

56 Commits

Author SHA1 Message Date
fiatjaf 6bda63de17 eventstore: delete badger, it's too buggy. 2025-08-04 15:16:25 -03:00
fiatjaf 7289da9c72 improve/refactor websocket connections hoping this will fix the undetected disconnections we're seeing.
this commit also remove all the sonic envelope parsing and reintroduces filters in REQ as a slice instead of as a singleton.

why? well, the sonic stuff wasn't really that fast, it was a little bit but only got fast enough once I introduced unsafe conversions between []byte and string and did weird unsafe reuse of []byte in order to save the values of tags, which would definitely cause issues in the future if the caller wasn't aware of it (and even if they were, like myself).

and the filters stuff is because we abandoned the idea of changing NIP-01 to only accept one filter per REQ.
2025-07-10 22:58:37 -03:00
fiatjaf 09d71a059e update websocket library hoping locking bugs will be fixed. 2025-07-05 11:12:59 -03:00
fiatjaf 46fba24b3e eliminate indirect go-nostr dependency. 2025-04-21 10:13:40 -03:00
fiatjaf cb0dd45a32 go mod tidy works now at least. 2025-04-15 18:40:56 -03:00
fiatjaf 0d5daf66bf sdk: beginnings of basic wot helpers. 2025-03-28 21:49:26 -03:00
fiatjaf 78dbf9def5 use our own dataloader and simplify batch replaceable requests, removing bugs. 2025-03-24 15:50:10 -03:00
fiatjaf 1b610ba318 khatru string transition 2025-03-12 00:55:08 -03:00
fiatjaf f19125af65 get rid of nocopy, do it directly. 2025-03-10 09:42:55 -03:00
fiatjaf 9e94310604 ridiculous performance string and serialization performance improvements. 2025-03-07 21:45:47 -03:00
fiatjaf 4431f58df2 update khatru so feeds_test can run again. 2025-03-07 21:23:54 -03:00
fiatjaf 765f16f86a update sonic so it works with go1.24 2025-03-07 16:31:10 -03:00
fiatjaf c9411a3c5b depressing sonic json decoder implementation, breakingly force COUNT to use a single filter, reorganize envelope tests. 2025-03-06 19:34:36 -03:00
fiatjaf 56e9a5a709 implement envelope, event and filter parsing with simdjson-go. 2025-02-25 17:57:15 -03:00
fiatjaf 6d8cd55784 fix and use a supposedly much faster library on NormalizeURL(), it's slightly less tolerant with stupidly-formed URLs. 2025-02-25 09:55:19 -03:00
fiatjaf c6747cdf44 nip60: fixes, actual Cashu stuff and a wallet.Receive() method. 2025-01-27 16:33:33 -03:00
fiatjaf 3334f7a48b implement nip60 events. 2025-01-25 23:35:53 -03:00
fiatjaf df6aaa3ad3 sdk: test for feeds and a fix. 2025-01-20 13:45:43 -03:00
fiatjaf faa4fabffe sdk: setup KVStore. 2025-01-15 14:29:35 -03:00
1l0 cb9e554fc9 nip22: prevent panic, return nil if not found according to nip10.go 2025-01-13 11:06:03 -03:00
reis 63919cf685 support wasm (#163) 2025-01-02 09:42:04 -03:00
fiatjaf 1778706817 add nip23 markdown helper. 2024-12-23 09:17:51 -03:00
fiatjaf 72d9aac9b1 replace all ocurrences of encoding/json with json-iterator so we get rid of HTML escaping and hopefully get faster too. 2024-12-03 00:49:27 -03:00
fiatjaf c5c9bba586 nip77: remove bloom filter, use a map. 2024-11-26 13:22:37 -03:00
fiatjaf ab52b3efb2 sdk: ristretto is generic now, no need for the fiatjaf fork. 2024-10-22 08:02:52 -03:00
fiatjaf 97ed96ef73 more tag helpers. 2024-10-13 10:32:43 -03:00
fiatjaf 2c09338ecb sdk/hints: sqlite backend and tests. 2024-09-16 22:23:55 -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 072da132f4 move nostr-sdk repository into here because why not? 2024-09-11 10:14:13 -03:00
K c91e7b9765 using testify instead of testing.T methods. (#143) 2024-09-09 07:20:56 -03:00
fiatjaf dd52fd4910 add nip44 (copied from reference implementation). 2024-05-15 10:24:19 -03:00
fiatjaf 2cba101c22 nip49: normalize passwords.
because nostr is a giant shit show:
https://github.com/nostr-protocol/nips/pull/1053
2024-02-15 22:21:12 -03:00
fiatjaf 385aa9c958 draft nip-34 helpers. 2024-02-07 21:44:47 -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 7692f1c148 go mod tidy 2023-12-29 18:16:58 -03:00
fiatjaf 2fd7c221ff use trunk ristretto for our hashing magic instead of modded fork. 2023-11-02 16:05:08 -03:00
fiatjaf 1789d43d51 move sdk out to its own module. 2023-10-31 17:49:27 -03:00
fiatjaf c506cc0f8b sdk taking shape. 2023-10-30 19:23:58 -03:00
fiatjaf eef7c40dc7 migrate to xsync v2. 2023-09-04 16:44:36 -03:00
fiatjaf 2e9cdc8255 dependencies from unsafe conversion stuff. 2023-08-06 19:54:17 -03:00
fiatjaf 39f09e6bb9 replace generic-sync-map with xsync. 2023-05-30 13:52:14 -03:00
fiatjaf f7ce78d7f8 add custom envelope types with json codecs. 2023-05-09 16:31:10 -03:00
Marc Tarnutzer 9c01ead91f switch to gobwas/ws, add compression 2023-05-04 23:51:15 +02:00
fiatjaf 0a3e898c2f using easyjson. 2023-04-16 15:56:50 -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 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