ssh

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskTickerInterval = 2
	DefaultBlockSize   = 65535
	FileTaskRunning    = "running"
	FileTaskDone       = "done"
	FileTaskFailed     = "failed"
	FileTaskCancel     = "cancel"
)
View Source
const (
	CMDTypeShell  = "cmd"
	CMDTypePlayer = "player"

	PollSize = 2000
)

Variables

This section is empty.

Functions

func RunTaskWithQuit

func RunTaskWithQuit(client *transport.Client, cmd string, quitCh chan bool, writer io.Writer) (err error)

Types

type Command

type Command struct {
	Type       string
	Params     string
	Sudo       bool
	WindowSize WindowSize
}

type FTaskResp

type FTaskResp struct {
	Id      string  `json:"id"`
	File    string  `json:"file"`
	Dest    string  `json:"dest"`
	Speed   string  `json:"speed"`
	Current string  `json:"current"`
	Total   string  `json:"total"`
	Status  string  `json:"status"`
	Percent float32 `json:"percent"`
}

type Manager

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

func NewManager

func NewManager(cfg *config.Conf) *Manager

func (*Manager) CancelTask

func (m *Manager) CancelTask(key string)

func (*Manager) GetAllPluginSchema

func (m *Manager) GetAllPluginSchema() []Schema

func (*Manager) GetFileList

func (m *Manager) GetFileList() *utils.SafeMap

func (*Manager) GetSSHList

func (m *Manager) GetSSHList() *cache.Cache

func (*Manager) GetStatus

func (m *Manager) GetStatus(host *models.Host) bool

func (*Manager) Init

func (m *Manager) Init() *Manager

func (*Manager) NewClient

func (m *Manager) NewClient(host *models.Host) (*transport.Client, error)

func (*Manager) NewClientWithSftp

func (m *Manager) NewClientWithSftp(host *models.Host) (*transport.Client, error)

NewClientWithSftp 创建新的ssh client并创建sftp客户端

func (*Manager) NewStep

func (m *Manager) NewStep(typ string, id string, conf []byte) (types.Step, error)

func (*Manager) ParseSteps

func (m *Manager) ParseSteps(params string) ([]types.Step, error)

func (*Manager) RegisterFileListSub

func (m *Manager) RegisterFileListSub(key string, notifyCh chan []FTaskResp)

func (*Manager) ReloadAllFilePlugins

func (m *Manager) ReloadAllFilePlugins(pluginPath string)

func (*Manager) RemoveCache

func (m *Manager) RemoveCache(host *models.Host)

func (*Manager) RemoveFileListSub

func (m *Manager) RemoveFileListSub(key string)

func (*Manager) UpdateTaskStatus

func (m *Manager) UpdateTaskStatus(task *TaskItem, status string)

func (*Manager) UploadFileStream

func (m *Manager) UploadFileStream(c *transport.Client, remote string, addr string, tmp *TempFile, parentCtx context.Context)

type Manifest added in v0.7.6

type Manifest struct {
	DisplayName string `yaml:"name"`
	Import      string `yaml:"import"`
}

Manifest The plugin manifest.

type Player

type Player struct {
	Steps []types.Step `json:"steps"`
	// contains filtered or unexported fields
}

func NewPlayer

func NewPlayer(client *transport.Client, steps []types.Step, sudo bool, size *WindowSize) *Player

func (*Player) Run

func (p *Player) Run(ctx context.Context) ([]byte, error)

type Result

type Result struct {
	Seq      int    `json:"seq"`
	Status   bool   `json:"status"`
	HostId   int    `json:"host_id"`
	HostName string `json:"hostname"`
	Msg      string `json:"msg"`
	Addr     string `json:"addr"`
}

type Schema

type Schema struct {
	Type   string      `json:"type"`
	Schema interface{} `json:"schema"`
	Desc   string      `json:"desc"`
}

type TaskItem

type TaskItem struct {
	Status   string
	Cancel   context.CancelFunc
	Total    int64 // 文件总字节
	RSize    int64 // 已传输字节
	CSize    int64 // 当前字节
	FileName string
	Host     string
}

type TempFile

type TempFile struct {
	Path string
	Name string
	Size int
	Num  int32
}

type WindowSize

type WindowSize struct {
	Cols int `json:"cols"`
	Rows int `json:"rows"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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