controller

package
v0.0.0-...-ab5a54e Latest Latest
Warning

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

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

Documentation

Overview

Package controller provides ping method

Package controller provides SSH control method

Package controller provides SSH control method

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSSHClient

func NewSSHClient(addr, user, password string) (*ssh.Client, error)

创建SSH客户端。创建出的客户端需要用户自己主动关闭。

func Ping

func Ping(addr string, pSize, count, timeout, port int)

Types

type ICMP

type ICMP struct {
	Type        uint8
	Code        uint8
	CheckSum    uint16
	Identifier  uint16
	SequenceNum uint16
}

定义ICMP数据结构

type SFTP

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

func (*SFTP) Close

func (s *SFTP) Close()

func (*SFTP) GetSFTP

func (s *SFTP) GetSFTP() *sftp.Client

func (*SFTP) Init

func (s *SFTP) Init(addr, user, password string) error

初始化SFTP

func (*SFTP) Pull

func (s *SFTP) Pull(localPath, remotePath string) error

从远程服务器下载

func (*SFTP) Push

func (s *SFTP) Push(localPath, remotePath string) error

上传文件或目录到远程服务器

func (*SFTP) SetContinue

func (s *SFTP) SetContinue(c bool)

设置是否继续执行标志

type SSH

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

SSH操作对象结构体

func (*SSH) Close

func (s *SSH) Close()

关闭

func (*SSH) Execute

func (s *SSH) Execute(opm string) error

远程执行命令

func (*SSH) GetClient

func (s *SSH) GetClient() *ssh.Client

获取SSH客户端

func (*SSH) Init

func (s *SSH) Init(addr, user, password string) error

Jump to

Keyboard shortcuts

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