nip11: omitempty all the things.

This commit is contained in:
fiatjaf
2025-08-25 07:32:21 -03:00
parent 926ed0830a
commit 6ab6b49940
2 changed files with 10 additions and 10 deletions

View File

@@ -6,8 +6,8 @@ import (
"net/http" "net/http"
"time" "time"
jsoniter "github.com/json-iterator/go"
"fiatjaf.com/nostr" "fiatjaf.com/nostr"
jsoniter "github.com/json-iterator/go"
) )
// Fetch fetches the NIP-11 metadata for a relay. // Fetch fetches the NIP-11 metadata for a relay.

View File

@@ -9,13 +9,13 @@ import (
type RelayInformationDocument struct { type RelayInformationDocument struct {
URL string `json:"-"` URL string `json:"-"`
Name string `json:"name"` Name string `json:"name,omitempty"`
Description string `json:"description"` Description string `json:"description,omitempty"`
PubKey nostr.PubKey `json:"pubkey"` PubKey *nostr.PubKey `json:"pubkey,omitempty"`
Contact string `json:"contact"` Contact string `json:"contact,omitempty"`
SupportedNIPs []any `json:"supported_nips"` SupportedNIPs []any `json:"supported_nips,omitempty"`
Software string `json:"software"` Software string `json:"software,omitempty"`
Version string `json:"version"` Version string `json:"version,omitempty"`
Limitation *RelayLimitationDocument `json:"limitation,omitempty"` Limitation *RelayLimitationDocument `json:"limitation,omitempty"`
RelayCountries []string `json:"relay_countries,omitempty"` RelayCountries []string `json:"relay_countries,omitempty"`
@@ -25,8 +25,8 @@ type RelayInformationDocument struct {
PaymentsURL string `json:"payments_url,omitempty"` PaymentsURL string `json:"payments_url,omitempty"`
Fees *RelayFeesDocument `json:"fees,omitempty"` Fees *RelayFeesDocument `json:"fees,omitempty"`
Retention []*RelayRetentionDocument `json:"retention,omitempty"` Retention []*RelayRetentionDocument `json:"retention,omitempty"`
Icon string `json:"icon"` Icon string `json:"icon,omitempty"`
Banner string `json:"banner"` Banner string `json:"banner,omitempty"`
} }
func (info *RelayInformationDocument) AddSupportedNIP(number int) { func (info *RelayInformationDocument) AddSupportedNIP(number int) {