From f13823956dbe5950f70ffc699fc428e1cb6478e9 Mon Sep 17 00:00:00 2001 From: Fabio1988 Date: Wed, 4 Oct 2023 19:15:34 +0200 Subject: [PATCH] add log on worker state mismatch with mitm --- routes/controller.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/routes/controller.go b/routes/controller.go index 9ebcb21..fb9aba9 100644 --- a/routes/controller.go +++ b/routes/controller.go @@ -5,6 +5,7 @@ import ( "flygon/config" "flygon/external" "flygon/worker" + "fmt" "github.com/gin-gonic/gin" log "github.com/sirupsen/logrus" "math" @@ -191,7 +192,13 @@ func handleGetJob(c *gin.Context, req ControllerBody, workerState *worker.State) return } if !isValid || workerState.Username != req.Username { - log.Debugf("[CONTROLLER] [%s] Account '%s' is not valid.", req.Uuid, req.Username) + var message string + if workerState.Username != req.Username { + message = fmt.Sprintf("is not equal to assigned worker account '%s'", workerState.Username) + } else { + message = "is not valid" + } + log.Debugf("[CONTROLLER] [%s] Account '%s' %s. Switch Account.", req.Uuid, req.Username, message) workerState.ResetUsername() workerState.ResetCounter() respondWithData(c, &map[string]any{