Configured Description filed into Event and Service configuration

This commit is contained in:
Mario
2022-05-31 22:39:56 +02:00
parent efefd0fb85
commit 25904ff751
4 changed files with 31 additions and 25 deletions

View File

@ -21,7 +21,7 @@ func (httpStrategy HypertextTransferProtocolStrategy) Init(beelzebubServiceConfi
serverMux := http.NewServeMux()
serverMux.HandleFunc("/", func(responseWriter http.ResponseWriter, request *http.Request) {
traceRequest(request, tr)
traceRequest(request, tr, beelzebubServiceConfiguration.Description)
for _, command := range httpStrategy.beelzebubServiceConfiguration.Commands {
matched, err := regexp.MatchString(command.Regex, request.RequestURI)
if err != nil {
@ -51,7 +51,7 @@ func (httpStrategy HypertextTransferProtocolStrategy) Init(beelzebubServiceConfi
return nil
}
func traceRequest(request *http.Request, tr tracer.Tracer) {
func traceRequest(request *http.Request, tr tracer.Tracer, HoneypotDescription string) {
bodyBytes, err := io.ReadAll(request.Body)
body := ""
if err == nil {
@ -70,6 +70,7 @@ func traceRequest(request *http.Request, tr tracer.Tracer) {
Status: tracer.Stateless.String(),
RemoteAddr: request.RemoteAddr,
ID: uuid.New().String(),
Description: HoneypotDescription,
})
}