sshutils

package module
v0.0.0-...-bd2f563 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 14 Imported by: 1

README

sshutils

sshutils 是一个 ssh 辅助工具库,用来创建交互式终端和执行远程命令

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSCPClient

func NewSCPClient(client *ssh.Client) (*scpClient, error)

Types

type SSHSession

type SSHSession struct {
	Stdout io.Reader
	Stdin  io.Writer
	Stderr io.Reader
	// contains filtered or unexported fields
}

func NewSSHSession

func NewSSHSession(session *ssh.Session) *SSHSession

New Session

func NewSSHSessionWithRoot

func NewSSHSessionWithRoot(session *ssh.Session, useSudo, noPasswordSudo bool, rootPassword, userPassword string) *SSHSession

New Session and auto switch root user

func NewSSHSessionWithRootAndCmdDelay

func NewSSHSessionWithRootAndCmdDelay(session *ssh.Session, useSudo, noPasswordSudo bool, rootPassword, userPassword string, cmdDelay time.Duration) *SSHSession

New Session and auto switch root user(support custom switch cmd delay)

func (*SSHSession) Close

func (s *SSHSession) Close() error

close the session

func (*SSHSession) PipeExec

func (s *SSHSession) PipeExec(cmd string) error

pipe exec

func (*SSHSession) Ready

func (s *SSHSession) Ready() <-chan int

func (*SSHSession) ShellDone

func (s *SSHSession) ShellDone() <-chan int

func (*SSHSession) Terminal

func (s *SSHSession) Terminal() error

open a interactive shell

func (*SSHSession) TerminalWithKeepAlive

func (s *SSHSession) TerminalWithKeepAlive(serverAliveInterval time.Duration) error

open a interactive shell with keepalive

Directories

Path Synopsis
_example
scp

Jump to

Keyboard shortcuts

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