Add server version header

This commit is contained in:
Torjus Håkestad 2021-06-18 14:51:14 +02:00
parent 248735710a
commit baa3990d38
2 changed files with 3 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import (
"runtime"
)
var Version = "v0.1.3"
var Version = "v0.1.4"
var Build string
func FullVersion() string {

View File

@ -14,6 +14,7 @@ import (
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/google/uuid"
"github.uio.no/torjus/apiary"
"github.uio.no/torjus/apiary/config"
"github.uio.no/torjus/apiary/honeypot"
"github.uio.no/torjus/apiary/honeypot/store"
@ -151,6 +152,7 @@ func (s *Server) HandlerAttemptStream(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Server", apiary.FullVersion())
id, ch := s.addAttemptListener()
defer s.closeAttemptListener(id)
w.WriteHeader(http.StatusOK)