Skip to content

Instantly share code, notes, and snippets.

@swissrouting
Created December 21, 2022 18:29
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swissrouting/78c8bdade7ac5e8e7961b4b4571b7bdd to your computer and use it in GitHub Desktop.
Save swissrouting/78c8bdade7ac5e8e7961b4b4571b7bdd to your computer and use it in GitHub Desktop.
#!/bin/bash
# Mirrors notes from one nostr relay to another.
#
# Example usage:
# nostr-mirror.sh wss://source.relay.example wss://target.relay.example
# Source relay to fetch events from (wss://...).
SOURCE=$1
# Target relay to send these events to (wss://...).
TARGET=$2
echo '["REQ", "mirror", {}]' | \
websocat -n --ping-interval 20 -B 400000 "${SOURCE}" | \
jq -c '[.[0,2]]' --unbuffered -M | \
websocat -n --ping-interval 20 -B 400000 "${TARGET}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment