run

package
v0.0.0-...-13cd3fb Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SSHPort define ssh port.
	SSHPort = "22"
)

Variables

This section is empty.

Functions

func CreateSSHClient

func CreateSSHClient(user, host, port, authType, authValue string) (*ssh.Client, error)

CreateSSHClient create ssh client

func ParseIpfile

func ParseIpfile(ipFile string, cu *CommonUser) ([]config.Host, error)

common logic

func ServersPull

func ServersPull(src, dst string, cu *CommonUser, ipFile string, force bool)

pull romote server file to local

func ServersPush

func ServersPush(src, dst string, cu *CommonUser, ipFile string, wt *sync.WaitGroup, ccons chan struct{}, crs chan machine.Result, timeout int)

push file or dir to remote servers

func ServersRun

func ServersRun(cmd string, cu *CommonUser, wt *sync.WaitGroup, crs chan machine.Result, ipFile string, ccons chan struct{}, safe bool, timeout int)

func ServersRun(cmd string, cu *CommonUser, wt *sync.WaitGroup, crs chan machine.Result, ipFile string, ccons chan struct{}) {

func SinglePull

func SinglePull(host string, cu *CommonUser, src, dst string, force bool)

func SinglePush

func SinglePush(ip, src, dst string, cu *CommonUser, f bool, timeout int)

func SingleRun

func SingleRun(host, cmd string, cu *CommonUser, force bool, timeout int)

Types

type CommonUser

type CommonUser struct {
	Force bool
	// contains filtered or unexported fields
}

func NewUser

func NewUser(user, port, psw string, force, encflag bool) *CommonUser

type Conn

type Conn interface {
	RunCommand() (string, error)
	Close()
	// contains filtered or unexported methods
}

type SSHConnection

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

SSHConnection supports to execute multi command

func NewSSHConnection

func NewSSHConnection(client *ssh.Client) (*SSHConnection, error)

func (*SSHConnection) Close

func (c *SSHConnection) Close()

func (*SSHConnection) RunCommand

func (c *SSHConnection) RunCommand(cmd string) (string, error)

type SSHConnectionWithTTY

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

SSHConnectionWithTTY supports to execute multi command with tty

func NewConnectionWithTTY

func NewConnectionWithTTY(client *ssh.Client) (*SSHConnectionWithTTY, error)

func (*SSHConnectionWithTTY) Close

func (c *SSHConnectionWithTTY) Close()

func (*SSHConnectionWithTTY) RunCommand

func (c *SSHConnectionWithTTY) RunCommand(cmd string) (string, error)

Jump to

Keyboard shortcuts

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