utils

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2021 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerHttpResponse = &HttpResponse{}

Functions

func ApiMessage

func ApiMessage(code uint32, message string, description interface{}, path string) map[string]interface{}

func ApiResponse

func ApiResponse(w http.ResponseWriter, data map[string]interface{})

func ApiResponseByteArray

func ApiResponseByteArray(w http.ResponseWriter, data []byte)

func ApiResponseError

func ApiResponseError(w http.ResponseWriter, data map[string]interface{})

func ApiResponseZip

func ApiResponseZip(w http.ResponseWriter, data []byte)

func AppendFile

func AppendFile(fileName string, content string)

func CloseFile

func CloseFile(file *os.File) error

func CreateDir

func CreateDir(dirName string)

func CreateFileIfNotExist

func CreateFileIfNotExist(fileName string)

func DeleteFile

func DeleteFile(fileName string)

func DeleteFiles

func DeleteFiles(fileNames []string)

func DoesFileExists

func DoesFileExists(filename string) bool

func GetAllProcesses

func GetAllProcesses() []*models.ProcessInfo

func GetAllProcessesByExecName

func GetAllProcessesByExecName(processName string) []*models.ProcessInfo

func GetBase64HashForTheCommand

func GetBase64HashForTheCommand(command string, cmdId string, suffix string) string

func GetCommandDetailsForEndedCommand

func GetCommandDetailsForEndedCommand(endedCommand *exec.Cmd) *models.CommandDetails

* ! The command must have already ended

func GetFormattedTimeAsString

func GetFormattedTimeAsString(timestamp time.Time) string

func GetMessage

func GetMessage() map[uint32]string

func GetProcessByPid

func GetProcessByPid(pid int) []*models.ProcessInfo

func GetProcessesForPid

func GetProcessesForPid(pid int) []*models.ProcessInfo

func IsFolder

func IsFolder(folderName string) bool

func KillAllCmdBackgroundProcesses

func KillAllCmdBackgroundProcesses()

func KillCmdBackgroundProcess

func KillCmdBackgroundProcess(cmdId string)

func KillProcess

func KillProcess(pid int)

func KillProcesses

func KillProcesses(processes []*models.ProcessInfo)

func OpenFile

func OpenFile(fileName string) *os.File

func ReadFile

func ReadFile(fileName string) []byte

func RecreateFile

func RecreateFile(fileName string)

func RecreateFiles

func RecreateFiles(fileNames []string)

func RunCommand

func RunCommand(command string) *models.CommandDetails

func RunCommandNoFile

func RunCommandNoFile(command string, cmdId string) *models.CommandDetails

func RunCommandToFile

func RunCommandToFile(command string, cmdId string) *models.CommandDetails

func StartCommand

func StartCommand(cmdId string, command []string, ch chan error)

func TrimSpacesAndLineEndings

func TrimSpacesAndLineEndings(data []string) []string

func WriteFile

func WriteFile(fileName string, content []byte)

func WriteFileJson

func WriteFileJson(fileName string, content interface{}) error

Types

type HttpResponse

type HttpResponse struct {
	Response interface{}
	Code     int
}

type YamlConfigParser

type YamlConfigParser struct {
	// contains filtered or unexported fields
}

func NewYamlConfigParser

func NewYamlConfigParser() *YamlConfigParser

func (*YamlConfigParser) CheckConfig

func (configParser *YamlConfigParser) CheckConfig(config *models.YamlConfig) error

func (*YamlConfigParser) GetCommandsList

func (configParser *YamlConfigParser) GetCommandsList(config *models.YamlConfig) []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL