|
|
@@ -14,6 +14,7 @@ import (
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
|
|
"github.com/go-chi/chi/v5/middleware"
|
|
|
|
"github.com/go-chi/chi/v5/middleware"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
|
|
|
|
"github.uio.no/torjus/apiary"
|
|
|
|
"github.uio.no/torjus/apiary/config"
|
|
|
|
"github.uio.no/torjus/apiary/config"
|
|
|
|
"github.uio.no/torjus/apiary/honeypot"
|
|
|
|
"github.uio.no/torjus/apiary/honeypot"
|
|
|
|
"github.uio.no/torjus/apiary/honeypot/store"
|
|
|
|
"github.uio.no/torjus/apiary/honeypot/store"
|
|
|
@@ -83,12 +84,12 @@ func NewServer(cfg config.FrontendConfig, hs *honeypot.HoneypotServer, store sto
|
|
|
|
r.Use(middleware.RealIP)
|
|
|
|
r.Use(middleware.RealIP)
|
|
|
|
r.Use(middleware.RequestID)
|
|
|
|
r.Use(middleware.RequestID)
|
|
|
|
r.Use(s.LoggingMiddleware)
|
|
|
|
r.Use(s.LoggingMiddleware)
|
|
|
|
|
|
|
|
r.Use(middleware.SetHeader("Server", apiary.FullVersion()))
|
|
|
|
|
|
|
|
|
|
|
|
r.Route("/", func(r chi.Router) {
|
|
|
|
r.Route("/", func(r chi.Router) {
|
|
|
|
r.Get("/*", s.IndexHandler("web/vue-frontend/dist"))
|
|
|
|
r.Get("/*", s.IndexHandler("web/vue-frontend/dist"))
|
|
|
|
r.Get("/stream", s.HandlerAttemptStream)
|
|
|
|
r.Get("/stream", s.HandlerAttemptStream)
|
|
|
|
r.Route("/api", func(r chi.Router) {
|
|
|
|
r.Route("/api", func(r chi.Router) {
|
|
|
|
r.Use(middleware.SetHeader("Content-Type", "application/json"))
|
|
|
|
|
|
|
|
r.Get("/stats", s.HandlerStats)
|
|
|
|
r.Get("/stats", s.HandlerStats)
|
|
|
|
r.Get("/stream", s.HandlerAttemptStream)
|
|
|
|
r.Get("/stream", s.HandlerAttemptStream)
|
|
|
|
r.Get("/query", s.HandlerQuery)
|
|
|
|
r.Get("/query", s.HandlerQuery)
|
|
|
|