well-goknown/main.go
2023-04-29 14:01:40 -04:00

39 lines
1.1 KiB
Go

package main
import (
"net/http"
"git.minhas.io/asara/well-goknown/config"
"git.minhas.io/asara/well-goknown/logger"
"git.minhas.io/asara/well-goknown/matrix"
"git.minhas.io/asara/well-goknown/nostr"
)
func main() {
/*
nostrTest := nostr.NostrRequest{
Name: "asara",
Key: "npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6",
Hostname: "devvul.com",
}
nostr.AddNostrAddr(nostrTest)
*/
// matrix endpoints
l := logger.Get()
l.Debug().Msg("enabling matrix server endpoint")
http.HandleFunc("/.well-known/matrix/server", matrix.MatrixServer)
l.Debug().Msg("enabling matrix client endpoint")
http.HandleFunc("/.well-known/matrix/client", matrix.MatrixClient)
// nostr endpoints
l.Debug().Msg("enabling nostr user endpoint")
http.HandleFunc("/.well-known/nostr.json", nostr.GetNostrAddr)
l.Debug().Msg("enabling nostr request endpoint")
http.HandleFunc("/request/nostr", nostr.RequestNostrAddr)
// start server
port := config.GetConfig().ListenAddr
l.Info().Msgf("starting server on %s", port)
http.ListenAndServe(port, nil)
}