Nostr relay written in go
- NIPs supported: 1, 9, 11, 12, 15, 16, 20, 26, 28, 33, 40, 42.
- Websocket compression support (
permessage-deflate), with support for client and server context takeover (i.e., sliding window support). - Hot config reloading. Edits to the
config.jsonfile will be instantly applied without requiring restart. --importcommand line flag allows new events to be added viastdin. Events should be injsonlformat. Use in conjunction with gnost-deflate-client- Event handling logic happens via SQL triggers (i.e., NIPs 9, 16, 33, 40).
- New events are notified to listeners via postgresql's built in
pg_notifyfeature. This implies that different instances ofgnost-relaycan be run concurrently. Indeed, any software which writes to the DB will automatically notify listeners connected to the relay. - Memory allocations are minimized using pools.
- Token bucket style rate limiters for handling the messages are enabled on each websocket connection.
DATABASE_URL=postgres://x gnost-relay --config config.jsonWith keepalive set, the connection will remain open, and new events will be added to the gnost-relay database, and notified to any listeners. See gnost-deflate-client for more info.
echo '[{"since":1676863922,"kinds":[1]}]' |\
gnost-deflate-client --port 443 --scheme wss --host nos.lol --keepalive 30 --output - |\
DATABASE_URL=postgres://x gnost-relay --import- Needs to have a
postgresqldatabase configured. The executable expects that theDATABASE_URLenvironment variable is set. - Should be run with a reverse proxy in front (e.g., NGINX).
- See the instructions for more details.