32 Commits

Author SHA1 Message Date
fiatjaf
7c9c5d7cd9 fix unsafe strings that change underneath us on envelope parsing by force-copying them as gjson doesn't. 2025-03-14 21:09:33 -03:00
fiatjaf
cecc71cd81 fix and improve envelope stuff again, deal with messages as strings on all envelope parsing steps. 2025-03-12 00:18:11 -03:00
fiatjaf
657c6edf6c remove sonic from the default build, guard it under "sonic" tag for now. 2025-03-10 17:33:32 -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
4fb6fcd9a2 make simdjson great again.
now it is generally a little faster than the easyjson approach.

goos: linux
goarch: amd64
pkg: github.com/nbd-wtf/go-nostr
cpu: AMD Ryzen 3 3200G with Radeon Vega Graphics
BenchmarkParseMessage/stdlib-4         	      90	  15616341 ns/op
BenchmarkParseMessage/easyjson-4       	     110	  11306466 ns/op
BenchmarkParseMessage/simdjson-4       	     162	   7779856 ns/op
PASS
ok  	github.com/nbd-wtf/go-nostr	5.547s
2025-03-05 23:56:15 -03:00
fiatjaf
5bfaed2740 docstrings for many functions. 2025-03-04 11:42:44 -03:00
fiatjaf
be2fe4a019 do not make the simd stuff a requirement for Envelope. 2025-02-25 18:23:38 -03:00
fiatjaf
56e9a5a709 implement envelope, event and filter parsing with simdjson-go. 2025-02-25 17:57:15 -03:00
fiatjaf
0ccc1b8e9c meaningless optimizations. 2025-02-04 17:52:05 -03:00
fiatjaf
e8d9464938 fix parsing COUNT envelopes without "hll". 2024-12-07 00:21:58 -03:00
fiatjaf
851116d2e3 Merge branch 'hyperloglog' 2024-12-07 00:13:23 -03:00
fiatjaf
529ade9376 nip45: hyperlolog small fixes and improvements. support deterministic offset for hardcoded set of queries. 2024-12-07 00:12:43 -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
0d40b40c9c pool: support CountMany() using hyperloglog. 2024-11-16 17:47:42 -03:00
fiatjaf
a0bf181547 remove HTML escaping from (easy)json encoder everywhere. 2024-11-11 22:55:07 -03:00
Chris Daley
9069fb6743 Removed duplicate array length check 2024-10-07 00:23:30 -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
abe84f9089 improve COUNT envelope codec and add a test. 2024-05-20 08:26:13 -03:00
ann
9a29edca41 fix: CountEnvelope json.Marshal 2024-05-20 07:18:27 -03:00
fiatjaf
1bccebbf2a
fix ParseMessage() so it works with CLOSED and improve tests. 2023-12-09 11:29:14 -03:00
fiatjaf
775821f4e5
fix CLOSED->CLOSE marshaling on CloseEnvelope. 2023-12-01 12:57:18 -03:00
fiatjaf
fa20f84ec7
support CLOSED messages. 2023-11-28 18:25:46 -03:00
fiatjaf
9287b9fb5e
accept > 2 items on EOSE and NOTICE envelopes, but ignore them.
fixes https://github.com/nbd-wtf/go-nostr/issues/110
2023-11-14 15:45:52 -03:00
fiatjaf
f8fb9e8c26
fix OKEnvelope always requiring the 4th field. 2023-11-04 17:30:19 -03:00
fiatjaf
61cd3130fd
remove unnecessary json tags from cc5979c. 2023-08-21 15:53:03 -03:00
Kay
ac2350c722 style: using effective go and refactoring 2023-08-21 15:50:05 -03:00
fiatjaf
53b9dde6e0
relay.Count() 2023-07-18 16:17:00 -03:00
fiatjaf
f6dddfd770
CountEnvelope. 2023-07-10 20:52:49 -03:00
boreq
b984a598cb Fix panic in ParseMessage
There is a chance the function can panic if a comma is included in the
input which is invalid.
2023-06-20 12:13:48 -03:00
fiatjaf
ccbb44989f
get rid of WriteJSON() and replace calls with manually marshaled envelopes. 2023-05-09 17:02:22 -03:00
fiatjaf
d36fbb95b9
ParseMessage() returns an Envelope, use that on the main relay handler loop. 2023-05-09 16:55:21 -03:00
fiatjaf
f7ce78d7f8
add custom envelope types with json codecs. 2023-05-09 16:31:10 -03:00