mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-07-07 07:30:12 +00:00
* Rename `mizu` to `kubeshark` * Rename `up9inc` to `kubeshark` * Change the logo, title, motto and the main color * Replace the favicon * Update the docs link * Change the copyright text in C files * Remove a comment * Rewrite the `README.md` and update the logo and screenshots used in it * Add a `TODO` * Fix the grammar * Fix the bottom text in the filtering guide * Change the Docker Hub username of cross-compilation intermediate images * Add an install script * Fix `docker/login-action` in the CI * Delete `build-custom-branch.yml` GitHub workflow * Update `README.md` * Remove `install.sh` * Change the motto back to "Traffic viewer for Kubernetes"
35 lines
803 B
Go
35 lines
803 B
Go
package controllers
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/kubeshark/kubeshark/agent/pkg/replay"
|
|
"github.com/kubeshark/kubeshark/agent/pkg/validation"
|
|
"github.com/kubeshark/kubeshark/logger"
|
|
)
|
|
|
|
const (
|
|
replayTimeout = 10 * time.Second
|
|
)
|
|
|
|
func ReplayRequest(c *gin.Context) {
|
|
logger.Log.Debug("Starting replay")
|
|
replayDetails := &replay.Details{}
|
|
if err := c.Bind(replayDetails); err != nil {
|
|
c.JSON(http.StatusBadRequest, err)
|
|
return
|
|
}
|
|
|
|
logger.Log.Debugf("Validating replay, %v", replayDetails)
|
|
if err := validation.Validate(replayDetails); err != nil {
|
|
c.JSON(http.StatusBadRequest, err)
|
|
return
|
|
}
|
|
|
|
logger.Log.Debug("Executing replay, %v", replayDetails)
|
|
result := replay.ExecuteRequest(replayDetails, replayTimeout)
|
|
c.JSON(http.StatusOK, result)
|
|
}
|