Files
timmy-config/allegro/relay/main.go
2026-03-31 20:02:01 +00:00

37 lines
1.1 KiB
Go

package main
import (
"fmt"
"net/http"
"github.com/fiatjaf/eventstore/sqlite3"
"github.com/fiatjaf/khatru"
)
func main() {
relay := khatru.NewRelay()
// Relay info for NIP-11
relay.Info.Name = "Timmy Foundation Sovereign Relay"
relay.Info.Description = "Sovereign Nostr relay for the Wizardly Council. Local-first, owned infrastructure."
relay.Info.PubKey = "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
relay.Info.Contact = "npub1timmyfoundation"
relay.Info.Software = "https://github.com/fiatjaf/khatru"
relay.Info.Version = "1.0.0"
db := sqlite3.SQLite3Backend{DatabaseURL: "/root/allegro/relay/khatru.db"}
if err := db.Init(); err != nil {
panic(err)
}
relay.StoreEvent = append(relay.StoreEvent, db.SaveEvent)
relay.QueryEvents = append(relay.QueryEvents, db.QueryEvents)
relay.CountEvents = append(relay.CountEvents, db.CountEvents)
relay.DeleteEvent = append(relay.DeleteEvent, db.DeleteEvent)
relay.ReplaceEvent = append(relay.ReplaceEvent, db.ReplaceEvent)
fmt.Println("Timmy Foundation Relay running on :3334")
fmt.Println("WebSocket URL: ws://167.99.126.228:3334")
http.ListenAndServe(":3334", relay)
}