MCPcopy Index your code
hub / github.com/barkyq/gnost-relay

github.com/barkyq/gnost-relay @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
40 symbols 103 edges 6 files 7 documented · 18%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

gnost-relay

Nostr relay written in go

Features

  • 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.json file will be instantly applied without requiring restart.
  • --import command line flag allows new events to be added via stdin. Events should be in jsonl format. 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_notify feature. This implies that different instances of gnost-relay can 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.

Example usage

Running the relay

DATABASE_URL=postgres://x gnost-relay --config config.json

Importing events

With 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

Installation notes

  • Needs to have a postgresql database configured. The executable expects that the DATABASE_URL environment variable is set.
  • Should be run with a reverse proxy in front (e.g., NGINX).
  • See the instructions for more details.

Core symbols most depended-on inside this repo

Done
called by 11
config.go
fastjsonArrayToStringList
called by 8
helpers.go
Parse
called by 5
nip11.go
Settings
called by 4
config.go
Release
called by 3
helpers.go
store_event
called by 3
storage.go
Error
called by 3
nip11.go
Release
called by 2
helpers.go

Shape

Method 17
Function 12
Struct 11

Languages

Go100%

Modules by API surface

helpers.go15 symbols
config.go8 symbols
nip11.go6 symbols
main.go6 symbols
storage.go3 symbols
websocket.go2 symbols

Datastores touched

nostrdbDatabase · 1 repos

For agents

$ claude mcp add gnost-relay \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact