Add relayinfo package and utility modules for NIP-11 support

Introduce the `relayinfo` package with `NIP-11` utilities, including `Fees`, `Limits`, and `NIPs` structures. Add utility modules for handling numbers, timestamps, and kinds. Integrate functionality for fetching and managing relay information.
This commit is contained in:
2025-08-21 15:22:17 +01:00
parent ecaf52b98f
commit 8add32bb78
16 changed files with 1541 additions and 2 deletions

29
app/listener.go Normal file
View File

@@ -0,0 +1,29 @@
package app
import (
"net/http"
"lol.mleku.dev/log"
"next.orly.dev/app/config"
)
type Listener struct {
mux *http.ServeMux
Config *config.C
}
func (l *Listener) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.I.F("path %v header %v", r.URL, r.Header)
if r.Header.Get("Upgrade") == "websocket" {
l.HandleWebsocket(w, r)
} else if r.Header.Get("Accept") == "application/nostr+json" {
l.HandleRelayInfo(w, r)
} else {
http.Error(w, "Upgrade required", http.StatusUpgradeRequired)
}
}
func (l *Listener) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
log.I.F("websocket")
return
}