Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/barkyq/gnost-deflate-client
go nostr client implementing permessage-deflate websocket compression
https://github.com/barkyq/gnost-deflate-client
nostr
Last synced: 24 days ago
JSON representation
go nostr client implementing permessage-deflate websocket compression
- Host: GitHub
- URL: https://github.com/barkyq/gnost-deflate-client
- Owner: barkyq
- License: gpl-3.0
- Created: 2023-02-18T03:46:12.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-22T03:49:58.000Z (almost 2 years ago)
- Last Synced: 2024-08-04T11:01:17.454Z (4 months ago)
- Topics: nostr
- Language: Go
- Homepage:
- Size: 77.1 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nostr - gnost-deflate-client - deflate-client?style=social) - CLI nostr client written in go implementing permessage-deflate websocket compression. (Clients / Relay lists)
README
# gnost-deflate-client
go nostr client implementing [permessage-deflate websocket compression](https://www.rfc-editor.org/rfc/rfc7692#section-7). Downloads the results of a REQ query, saving the results in [jsonl format](https://jsonlines.org/), and logs to `stderr` some stats related to the compression.## Building
In cloned repository run `go build .` to build the executable `gnost-deflate-client`.## Running
Accepts an array of filter json objects on stdin, and saves the returned events to a `.jsonl` file:
``` zsh
echo '[{
"authors":["3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
"since":1676600000
}]' | ./gnost-deflate-client --port 443 --scheme wss --host nos.lol --output events.jsonl
```#### Keep connection alive
Use the `--keepalive N` option to keep the connection alive, sending a PING frame to the relay every `N` seconds. New returned events will be appended to the `--output` file. Enter `C-c` to cleanly shutdown the listener.#### Compatibility with relays
Set the output to `-` in order to print the returned events to `stdout`. This can be composed with the `import` command for a local instance of [gnost-relay](https://github.com/barkyq/gnost-relay) or [strfry](https://github.com/hoytech/strfry)
```zsh
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
```
```zsh
echo '[{
"authors":["3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
"since":1676600000
}]' | ./gnost-deflate-client --port 443 --scheme wss --host nos.lol --output - | strfry import
```
Note that `strfry import` is not compatible with `--keepalive` since `strfry` expects an `EOF` from `stdin`.