fetch with optional --relay flags.

This commit is contained in:
fiatjaf
2023-10-20 21:01:11 -03:00
parent 757a6eb313
commit ffa41046fd
3 changed files with 38 additions and 26 deletions

View File

@@ -3,7 +3,6 @@ package main
import (
"encoding/hex"
"fmt"
"net/url"
"strings"
"github.com/nbd-wtf/go-nostr/nip19"
@@ -220,22 +219,3 @@ func validate32BytesHex(target string) error {
return nil
}
func validateRelayURLs(wsurls []string) error {
for _, wsurl := range wsurls {
u, err := url.Parse(wsurl)
if err != nil {
return fmt.Errorf("invalid relay url '%s': %s", wsurl, err)
}
if u.Scheme != "ws" && u.Scheme != "wss" {
return fmt.Errorf("relay url must use wss:// or ws:// schemes, got '%s'", wsurl)
}
if u.Host == "" {
return fmt.Errorf("relay url '%s' is missing the hostname", wsurl)
}
}
return nil
}