mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-10-11 05:13:47 +02:00
localhost and 127.0.0.1 are "virtual" relays, but not when running go test
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"math"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -21,12 +22,16 @@ func IsVirtualRelay(url string) bool {
|
||||
|
||||
if strings.HasPrefix(url, "wss://feeds.nostr.band") ||
|
||||
strings.HasPrefix(url, "wss://filter.nostr.wine") ||
|
||||
strings.HasPrefix(url, "ws://localhost") ||
|
||||
strings.HasPrefix(url, "ws://127.0.0.1") ||
|
||||
strings.HasPrefix(url, "wss://cache") {
|
||||
return true
|
||||
}
|
||||
|
||||
if !testing.Testing() &&
|
||||
strings.HasPrefix(url, "ws://localhost") ||
|
||||
strings.HasPrefix(url, "ws://127.0.0.1") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user