package websocket import ( "encoding/json" "net/http" ) type RelayInfo struct { Name string `json:"name"` Description string `json:"description"` Pubkey string `json:"pubkey,omitempty"` Contact string `json:"contact,omitempty"` SupportedNIPs []int `json:"supported_nips"` Software string `json:"software"` Version string `json:"version"` Limitation *Limits `json:"limitation,omitempty"` } type Limits struct { MaxMessageLength int `json:"max_message_length,omitempty"` MaxSubscriptions int `json:"max_subscriptions,omitempty"` MaxFilters int `json:"max_filters,omitempty"` MaxLimit int `json:"max_limit,omitempty"` MaxSubidLength int `json:"max_subid_length,omitempty"` MaxEventTags int `json:"max_event_tags,omitempty"` MaxContentLength int `json:"max_content_length,omitempty"` MinPowDifficulty int `json:"min_pow_difficulty,omitempty"` AuthRequired bool `json:"auth_required"` PaymentRequired bool `json:"payment_required"` RestrictedWrites bool `json:"restricted_writes"` } func (h *Handler) ServeNIP11(w http.ResponseWriter, r *http.Request) { info := RelayInfo{ Name: "nostr-grpc relay", Description: "High-performance Nostr relay with gRPC, Connect, and WebSocket support", SupportedNIPs: []int{1, 9, 11}, Software: "northwest.io/nostr-grpc", Version: "0.1.0", Limitation: &Limits{ MaxMessageLength: 65536, MaxSubscriptions: 20, MaxFilters: 10, MaxLimit: 5000, MaxSubidLength: 64, MaxEventTags: 2000, MaxContentLength: 65536, AuthRequired: false, PaymentRequired: false, RestrictedWrites: false, }, } w.Header().Set("Content-Type", "application/nostr+json") w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Accept") w.Header().Set("Access-Control-Allow-Methods", "GET") json.NewEncoder(w).Encode(info) }