mirror of
https://github.com/aljazceru/haven.git
synced 2026-01-17 04:14:26 +01:00
25 lines
483 B
Go
25 lines
483 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
|
|
"github.com/nbd-wtf/go-nostr"
|
|
)
|
|
|
|
func blast(ev *nostr.Event) {
|
|
ctx := context.Background()
|
|
for _, relay := range config.BlastrRelays {
|
|
go blastRoutine(ctx, relay, ev)
|
|
}
|
|
}
|
|
|
|
func blastRoutine(ctx context.Context, relay string, ev *nostr.Event) {
|
|
connect, err := nostr.RelayConnect(ctx, relay)
|
|
if err != nil {
|
|
log.Println("error connecting to relay", relay, err)
|
|
}
|
|
connect.Publish(ctx, *ev)
|
|
log.Println("🔫 blasted to", relay)
|
|
}
|