utils

package
v0.4.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineEventCategory

func DetermineEventCategory(kind int) string

func EnsureFileExists

func EnsureFileExists(filePath string, content []byte)

EnsureFileExists creates a file from embedded content if it doesn't exist

func FetchPubkeysFromDomains

func FetchPubkeysFromDomains(domains []string) ([]string, error)

FetchPubkeysFromDomains fetches nostr.json pubkeys from multiple domains This function is called by the pubkey cache system and doesn't maintain its own cache

func GetClientIP

func GetClientIP(r *http.Request) string

func LoadRelayMetadata

func LoadRelayMetadata(filename string) error

func LoadRelayMetadataJSON

func LoadRelayMetadataJSON() error

func RelayInfoHandler

func RelayInfoHandler(w http.ResponseWriter, r *http.Request)

func SendToBackupRelay

func SendToBackupRelay(backupURL string, evt nostr.Event) error

func ToInt

func ToInt(i interface{}) *int

func ToInt64

func ToInt64(i interface{}) *int64

func ToIntArray

func ToIntArray(i interface{}) []int

func ToStringArray

func ToStringArray(i interface{}) []string

func ToTagsMap

func ToTagsMap(i interface{}) map[string][]string

func ToTime

func ToTime(data interface{}) *time.Time

Types

type NostrJSON

type NostrJSON struct {
	Names map[string]string `json:"names"`
}

NostrJSON represents the structure of .well-known/nostr.json

type RelayMetadata

type RelayMetadata struct {
	Name           string `json:"name"`
	Description    string `json:"description"`
	Banner         string `json:"banner"`
	Icon           string `json:"icon"`
	Pubkey         string `json:"pubkey"`
	Contact        string `json:"contact"`
	SupportedNIPs  []int  `json:"supported_nips"`
	Software       string `json:"software"`
	Version        string `json:"version"`
	PrivacyPolicy  string `json:"privacy_policy"`
	TermsOfService string `json:"terms_of_service"`
	Limitation     struct {
		MaxMessageLength    int    `json:"max_message_length"`
		MaxContentLength    int    `json:"max_content_length"`
		MaxSubscriptions    int    `json:"max_subscriptions"`
		MaxLimit            int    `json:"max_limit"`
		AuthRequired        bool   `json:"auth_required"`
		PaymentRequired     bool   `json:"payment_required"`
		RestrictedWrites    bool   `json:"restricted_writes"`
		CreatedAtLowerLimit *int64 `json:"created_at_lower_limit"`
		CreatedAtUpperLimit *int64 `json:"created_at_upper_limit"`
	} `json:"limitation"`
	RelayCountries []string `json:"relay_countries"`
	LanguageTags   []string `json:"language_tags"`
	Tags           []string `json:"tags"`
	PostingPolicy  string   `json:"posting_policy"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL