62 Commits

Author SHA1 Message Date
fiatjaf
a103353254 fix development mess. 2024-08-01 12:41:27 -03:00
fiatjaf
a63dc829df routing. 2024-07-30 12:53:27 -03:00
fiatjaf
5c7121a3f6 update go-nostr to fix some bugs. 2024-07-12 13:47:25 -03:00
fiatjaf
535f4c90e0 split nip11 handler into its own file and implement nip86 (relay management api). 2024-07-08 15:42:42 -03:00
fiatjaf
f8afb51ee9 ratelimits. 2024-05-12 20:37:00 -03:00
fiatjaf
35053f6215 when LimitZero don't do any database queries. 2024-03-29 08:12:39 -03:00
fiatjaf
9b43da0b17
use stdlib "slices". 2024-02-08 16:35:35 -03:00
fiatjaf
eb83307005
update dependencies. 2024-01-18 18:20:39 -03:00
fiatjaf
f450c26d84
update go-nostr and xsync. 2024-01-10 16:27:50 -03:00
fiatjaf
08a527f9d8
upgrade eventstore dependency. 2023-12-22 19:50:32 -03:00
fiatjaf
7e06629953
superficial tweaks to auth handling. 2023-12-09 14:41:54 -03:00
fiatjaf
d3a0c545d2
GetIP() and GetOpenSubscriptions() utils. 2023-12-09 08:19:37 -03:00
fiatjaf
386a89676a
use go-nostr envelopes and support CLOSED when filters are rejected. 2023-11-28 22:43:06 -03:00
fiatjaf
8fd6436ac8
rework nip11 support to be more transparent. 2023-11-18 10:35:08 -03:00
fiatjaf
80586c4573
update go-nostr to fix the OK envelope bug. 2023-11-04 17:31:39 -03:00
fiatjaf
6acf1b4366
update eventstore and badger/lmdb examples. 2023-11-02 20:16:17 -03:00
fiatjaf
bf2c9e4640
use eventstore release v0.0.1 2023-10-31 16:48:05 -03:00
fiatjaf
b6e7fabeb6
move storage plugins to eventstore module. 2023-10-31 16:38:32 -03:00
fiatjaf
bbe186494e
replace mutex-guarded maps with xsync/v2 maps. 2023-10-03 08:32:07 -03:00
fiatjaf
8968982b9a
relayer, second attempt, now much better. 2023-08-10 14:32:11 -03:00
fiatjaf
dc594ee32b
migrate to fasthttp/websocket. 2023-06-23 07:10:59 -03:00
fiatjaf
ebfff13b18 use envelopes everywhere. 2023-06-16 17:48:34 -03:00
fiatjaf
b2bf358789
update to go-nostr 0.18.3 2023-05-18 09:47:04 -03:00
Yasuhiro Matsumoto
2771d9b8ba fix(all): use v2 module 2023-05-08 12:49:11 -03:00
bndw
ae641fd24d refactor(postgres): make SQL generation testable
Decouples the postgresql sql generation from the query execution.
This allows the logic for building sql to be unit tested without
access to a database.

This work was motivated when a client was not receiving events as
expected. In debugging I found that if a tag's value was an empty array,
then no query would be executed - and to my surprised no error is
raised either. I wanted to get a better sense of the current constraints on
when queries are and are not executed, but I had a hard time keeping the
code in my head. This led me to extracting the sql generation into its
own function and writing the unit tests that document its current
behavior. This refactor makes no changes to the current logic. I have added
some REVIEW comments in the test cases where I thought some error handling
could be introduced but I wanted to first see if you were receptive to this
refactor before proposing any functional changes.
2023-05-02 12:41:51 -03:00
fiatjaf
4e15120111
migrate all built-in storage backends. 2023-05-01 19:41:17 -03:00
fiatjaf
e3d4655dba
v2 with breaking changes and a simpler API. 2023-05-01 19:21:09 -03:00
mattn
0e7c7f8abb
add sqlite3 storage (#40)
* add sqlite3 storage

* filter by content

* remove needless files

* update go.mod

* do not unquote Search
2023-02-26 14:57:47 -03:00
fiatjaf
eb0c6539b6
update go-nostr dependency and gitignore search binary. 2023-02-15 20:27:51 -03:00
Steve Perkins
a7a0bb6682 Use dsl builder for es query 2023-02-15 16:29:54 -05:00
Steve Perkins
0e18a49861 wip docker-compose setup 2023-02-13 20:44:06 -05:00
Steve Perkins
05600231b4 support search req a-la nip-50 2023-02-10 14:58:01 -05:00
Steve Perkins
d306c03369 basic elasticsearch storage example 2023-02-06 13:30:51 -05:00
fiatjaf
905a68cd91
update dependencies. 2023-01-26 20:03:50 -03:00
fiatjaf
fe91197d45
implement nip-42 AUTH and restrict DMs to authed users. 2023-01-15 22:38:24 -03:00
fiatjaf
e70a5601c7
update go-nostr and fix rss-bridge. 2023-01-02 14:31:28 -03:00
alex
627724f702 start: introduce Server type and Shutdown (breaking change)
the main motivation for this change is to be able to run tests.
before this commit, Start, Router and Log operated on global variables,
making automated testing unreasonably hard.

this commit puts all that a server needs in a new Server type,
which also made it possible for a Server.Shutdown - see ShutdownAware
doc comments.

BREAKING CHANGES:
- Relay.OnInitialized takes one argument now, *relayer.Server.
- relayer.Router is now replaced by relayer.Server.Router().
  package users can still hook into the router from OnInitialized
  for custom HTTP routing.
- relayer.Log is gone. apart from another global var, imho this was
  a too opinionated choice for a framework to build a custom relay upon.
  this commit introduces a Logger interface which package users can implement
  for zerolog to make it log like before. see Server.Log for details.

other notable changes: finally added a couple basic tests, for start up
and shutdown. doc comments now explain most of the essentials,
hopefully making it more approachable for newcomers and easier to understand
the relayer package.

the changes in handlers.go are minimal, although git diff goes crazy.
this is because most of the lines are simply shifted indentation back by one
due to go fmt.

before this commit:

    func handleWebsocket(relay Relay) func(http.ResponseWriter, *http.Request)
    func handleNIP11(relay Relay) func(http.ResponseWriter, *http.Request)

after:

    func (s *Server) handleWebsocket(w http.ResponseWriter, r *http.Request)
    func (s *Server) handleNIP11(w http.ResponseWriter, r *http.Request)
2022-12-24 20:41:02 -03:00
fiatjaf
9684033223
update go-nostr dependency and tag release. 2022-12-19 09:31:49 -03:00
fiatjaf
5f8908e028
update go-nostr dependency. 2022-11-26 09:27:08 -03:00
fiatjaf
d7aba0b21f
fix some dependencies and storage instantiation on example relays. 2022-11-11 09:46:18 -03:00
fiatjaf
eee9952fac base58 bad-coding session. 2022-08-12 17:02:40 -03:00
fiatjaf
396ca4d3a0 use updated lnsocket library. 2022-07-25 15:03:37 -03:00
fiatjaf
13d57303b5 support "limit" field on filters. 2022-07-24 19:58:34 -03:00
fiatjaf
fbb81c868c bring in and refactor rss bridge. 2022-07-24 19:52:25 -03:00
fiatjaf
aa96fa0a21 refactor framework interface, simplify basic and whitelisted, bring expensive on and rewrite it. 2022-07-24 17:41:00 -03:00
fiatjaf
d2ce4dbf54 implement nip-16 on closed and basic relays. 2022-07-24 11:48:34 -03:00
fiatjaf
440a64ef28 update go-nostr. 2022-07-24 11:35:49 -03:00
fiatjaf
42fee9cb1d update go-nostr. 2022-05-02 16:55:23 -03:00
fiatjaf
e50a298496 update go-nostr for a fix. 2022-02-13 20:37:51 -03:00
fiatjaf
f9d058a95a adapt to updated go-nostr. 2022-02-13 08:40:06 -03:00