Randomize access to the hardcoded relays list

This commit is contained in:
Daniele Tonon
2023-07-12 17:50:19 +02:00
parent 0dd5ad262f
commit 0cbb4918e6

View File

@@ -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]
}