Documentation
¶
Index ¶
- Constants
- func CreateSSHClient(user, host, port, authType, authValue string) (*ssh.Client, error)
- func ParseIpfile(ipFile string, cu *CommonUser) ([]config.Host, error)
- func ServersPull(src, dst string, cu *CommonUser, ipFile string, force bool)
- func ServersPush(src, dst string, cu *CommonUser, ipFile string, wt *sync.WaitGroup, ...)
- func ServersRun(cmd string, cu *CommonUser, wt *sync.WaitGroup, crs chan machine.Result, ...)
- func SinglePull(host string, cu *CommonUser, src, dst string, force bool)
- func SinglePush(ip, src, dst string, cu *CommonUser, f bool, timeout int)
- func SingleRun(host, cmd string, cu *CommonUser, force bool, timeout int)
- type CommonUser
- type Conn
- type SSHConnection
- type SSHConnectionWithTTY
Constants ¶
View Source
const (
// SSHPort define ssh port.
SSHPort = "22"
)
Variables ¶
This section is empty.
Functions ¶
func CreateSSHClient ¶
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)
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 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)
Click to show internal directories.
Click to hide internal directories.