mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 13:22:56 +01:00
21 lines
303 B
Go
21 lines
303 B
Go
package nostr
|
|
|
|
import (
|
|
"net/url"
|
|
"strings"
|
|
)
|
|
|
|
func IsValidRelayURL(u string) bool {
|
|
parsed, err := url.Parse(u)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
if parsed.Scheme != "wss" && parsed.Scheme != "ws" {
|
|
return false
|
|
}
|
|
if len(strings.Split(parsed.Host, ".")) < 2 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|