Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

Commit

Permalink
add log on worker state mismatch with mitm
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio1988 committed Oct 4, 2023
1 parent faa4a2e commit f138239
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion routes/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"flygon/config"
"flygon/external"
"flygon/worker"
"fmt"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"math"
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit f138239

Please sign in to comment.