ssh

package
v0.0.0-...-6231a78 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 5 Imported by: 0

README

ssh

ssh

实现

  • ssh 密码、密钥、加密密钥连接
  • 执行单条命令,返回结果
  • 顺序执行一组命令,返回结果
  • 并行执行一组命令 返回结果

Documentation

Overview

ssh

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SSH

type SSH struct {
	Host          string `json:"host"`
	Port          int    `json:"port"`
	User          string `json:"user"`
	Password      string `json:"password"`
	KeyPath       string `json:"keyPath"`
	KeyPathPasswd string `json:"keyPathPasswd"`
	KeyStrByte    []byte // 字节密钥
	// contains filtered or unexported fields
}

func (*SSH) Connect

func (gs *SSH) Connect() (*ssh.Session, error)

连接 Session

func (*SSH) Init

func (gs *SSH) Init() error

初始化 ssh 客户端配置 密钥存在,优先使用密钥

func (*SSH) RunCmd

func (gs *SSH) RunCmd(cmd string) (string, error)

运行命令

func (*SSH) RunCmdsParallel

func (gs *SSH) RunCmdsParallel(cmds []string) ([]string, error)

运行一组命令,并行执行,结果顺序与命令顺序一致

func (*SSH) RunCmdsSequential

func (gs *SSH) RunCmdsSequential(cmds []string) ([]string, error)

运行一组命令,顺序执行

Jump to

Keyboard shortcuts

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