21 Commits

Author SHA1 Message Date
Yasuhiro Matsumoto
13adc5c563 breaking compatibility: AcceptEvent should return msg 2025-03-28 09:15:30 -03:00
Yasuhiro Matsumoto
5281f6630d fix EventCounter 2024-01-29 21:38:49 +09:00
bndw
bf5df1248f feat: Add authed pubkey to ReqAccepter
Pass the nip-42 pubkey to the ReqAccepter. This allows a relay to
authenticate REQs.
2023-11-21 17:13:34 -08:00
fiatjaf
8273e44295 remove storage plugins and move those to eventstore module. 2023-10-31 16:16:38 -03:00
Yasuhiro Matsumoto
1db1c6d697 add ReqAccepter to handle request filters
fixes #94
2023-10-06 23:08:02 +09:00
mattn
639c210661 support NIP-45 (#58) 2023-05-17 07:54:56 -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
Dylan Cant
c05896a2e3 fixed typos added docstring 2023-01-16 08:26:41 -03:00
fiatjaf
fe91197d45 implement nip-42 AUTH and restrict DMs to authed users. 2023-01-15 22:38:24 -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
d69479974c expose AddEvent() method, allow implementations to deal with unknown websocket messages, remove opinionated validations from core lib, implement NIP-20 ("OK" message). 2022-11-11 09:48:11 -03:00
fiatjaf
eee9952fac base58 bad-coding session. 2022-08-12 17:02:40 -03:00
fiatjaf
13d57303b5 support "limit" field on filters. 2022-07-24 19:58:34 -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
4daac2fc28 implement nip-09, event deletion. 2022-07-24 11:35:49 -03:00
fiatjaf
8cc12a6bd9 implement nip-11, relay information document. 2022-07-24 11:35:49 -03:00
fiatjaf
f9d058a95a adapt to updated go-nostr. 2022-02-13 08:40:06 -03:00
fiatjaf
629c9174eb update go-nostr. 2022-01-02 09:00:14 -03:00
fiatjaf
ba0d99c131 GetListenerFilters() helper and Injector interface for implementations. 2021-12-26 07:11:54 -03:00
fiatjaf
30eae726c1 turn relayer into a server framework and put actual relay code into ./basic 2021-12-25 21:22:40 -03:00