From 0cbb4918e6f0cbad09e660648c745ce10912d6e6 Mon Sep 17 00:00:00 2001 From: Daniele Tonon Date: Wed, 12 Jul 2023 17:50:19 +0200 Subject: [PATCH] Randomize access to the hardcoded relays list --- nostr.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nostr.go b/nostr.go index 7b1ff9c..405451a 100644 --- a/nostr.go +++ b/nostr.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "math/rand" "time" "github.com/nbd-wtf/go-nostr" @@ -36,6 +37,9 @@ var ( ) func getRelay() string { + if serial == 0 { + serial = rand.Intn(len(everything)) + } serial = (serial + 1) % len(everything) return everything[serial] }