executor

package
v0.0.0-...-25da3cc Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetType_Http  = "http"
	TargetType_Shell = "shell"
	TargetType_GoSo  = "goso"
	TargetType_Code  = "code"

	CorrectStatus = "200 OK"
	CorrectResult = "OK"
)
View Source
const (
	HttpMethod_HEAD = "HEAD"
	HttpMethod_GET  = "GET"
	HttpMethod_POST = "POST"
)
View Source
const (
	ShellType_Script = "SCRIPT"
	ShellType_File   = "FILE"
	ShellFilePath    = "shells/"
)
View Source
const GoFilePath = "plugins/"

Variables

View Source
var (
	ErrorNotSupportShellType       = errors.New("not support shell type")
	ErrorShellFileNotInSpecifyPath = errors.New("shell file not in specify path")
	ErrorNotEnabledShellScriptMode = errors.New("shell script mode is not enabled")
)
View Source
var (
	ErrorGoSoFileNotInSpecifyPath = errors.New("go.so file not in specify path")
)
View Source
var ErrorNotMatchConfigType = errors.New("not match config type")

Functions

func ValidateTargetType

func ValidateTargetType(execType string) bool

ValidateTargetType validate the TargetType is supported

Types

type Exec

type Exec func(ctx *task.TaskContext) error

type Executor

type Executor interface {
	GetTask() task.Task
	SetTask(task.Task)
	GetTaskID() string
	GetTargetType() string
	GetTaskConfig() *core.TaskConfig
	Exec(*task.TaskContext) error
}

func NewDebugGoExecutor

func NewDebugGoExecutor(taskID string) Executor

func NewDebugHttpExecutor

func NewDebugHttpExecutor(taskID string) Executor

func NewDebugShellExecutor

func NewDebugShellExecutor(taskID string) Executor

type GoConfig

type GoConfig struct {
	FileName string
}

func (*GoConfig) LoadFromJson

func (c *GoConfig) LoadFromJson(json string) error

type GoExecutor

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

func NewGoExecutor

func NewGoExecutor(conf *core.TaskConfig) (*GoExecutor, error)

func (*GoExecutor) Exec

func (exec *GoExecutor) Exec(ctx *task.TaskContext) error

func (*GoExecutor) GetTargetType

func (exec *GoExecutor) GetTargetType() string

func (*GoExecutor) GetTask

func (exec *GoExecutor) GetTask() task.Task

func (*GoExecutor) GetTaskConfig

func (exec *GoExecutor) GetTaskConfig() *core.TaskConfig

func (*GoExecutor) GetTaskID

func (exec *GoExecutor) GetTaskID() string

func (*GoExecutor) SetTask

func (exec *GoExecutor) SetTask(task task.Task)

type HttpConfig

type HttpConfig struct {
	Url         string
	Method      string
	ContentType string
	PostBody    string
	Timeout     int //单位为秒
}

func (*HttpConfig) LoadFromJson

func (c *HttpConfig) LoadFromJson(json string) error

type HttpExecutor

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

func NewHttpExecutor

func NewHttpExecutor(conf *core.TaskConfig) (*HttpExecutor, error)

func (*HttpExecutor) Exec

func (exec *HttpExecutor) Exec(ctx *task.TaskContext) error

func (*HttpExecutor) GetTargetType

func (exec *HttpExecutor) GetTargetType() string

func (*HttpExecutor) GetTask

func (exec *HttpExecutor) GetTask() task.Task

func (*HttpExecutor) GetTaskConfig

func (exec *HttpExecutor) GetTaskConfig() *core.TaskConfig

func (*HttpExecutor) GetTaskID

func (exec *HttpExecutor) GetTaskID() string

func (*HttpExecutor) SetTask

func (exec *HttpExecutor) SetTask(task task.Task)

type ShellConfig

type ShellConfig struct {
	Type   string //default will be ShellType_Script
	Script string
}

func (*ShellConfig) LoadFromJson

func (c *ShellConfig) LoadFromJson(json string) error

type ShellExecutor

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

func NewShellExecutor

func NewShellExecutor(conf *core.TaskConfig) (*ShellExecutor, error)

func (*ShellExecutor) Exec

func (exec *ShellExecutor) Exec(ctx *task.TaskContext) error

func (*ShellExecutor) GetTargetType

func (exec *ShellExecutor) GetTargetType() string

func (*ShellExecutor) GetTask

func (exec *ShellExecutor) GetTask() task.Task

func (*ShellExecutor) GetTaskConfig

func (exec *ShellExecutor) GetTaskConfig() *core.TaskConfig

func (*ShellExecutor) GetTaskID

func (exec *ShellExecutor) GetTaskID() string

func (*ShellExecutor) SetTask

func (exec *ShellExecutor) SetTask(task task.Task)

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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