Documentation ¶
Index ¶
- Variables
- func NewFilteredReader(underReader io.Reader, pidChan chan string, retCodeChan chan string) io.Reader
- func SetVerbose(_verbose bool)
- type BufferCloser
- type Conn
- type ExecContext
- func (ctx *ExecContext) AbsPath(p string) string
- func (ctx *ExecContext) Close()
- func (ctx *ExecContext) CloseSession(session Session)
- func (ctx *ExecContext) Connect() (err error)
- func (ctx *ExecContext) DeleteFile(p string) (err error)
- func (ctx *ExecContext) DeleteLink(p string) (err error)
- func (ctx *ExecContext) ExecSession(setupFns ...SessionSetupFn) (retCode int, err error)
- func (ctx *ExecContext) Hostname() string
- func (ctx *ExecContext) Init()
- func (ctx *ExecContext) IsConnected() bool
- func (ctx *ExecContext) IsDarwin() bool
- func (ctx *ExecContext) IsLinux() bool
- func (ctx *ExecContext) IsLocal() bool
- func (ctx *ExecContext) IsWindows() bool
- func (ctx *ExecContext) KillAllSessions()
- func (ctx *ExecContext) ListDirectory(path string) (files []string, err error)
- func (ctx *ExecContext) Logger() *alog.Logger
- func (ctx *ExecContext) MakeSession() (Session, error)
- func (ctx *ExecContext) Mkdirp(p string) (err error)
- func (ctx *ExecContext) NameAnsi() string
- func (ctx *ExecContext) NewLogger(suffix string) *alog.Logger
- func (ctx *ExecContext) Output(args ...string) (stdout string, err error)
- func (ctx *ExecContext) OutputCwd(cwd string, args ...string) (stdout string, err error)
- func (ctx *ExecContext) OutputShell(s string) (stdout string, err error)
- func (ctx *ExecContext) PathExists(path string) (bool, error)
- func (ctx *ExecContext) Quote(suffix string, args ...string) (retCode int, err error)
- func (ctx *ExecContext) QuoteCwd(suffix string, cwd string, args ...string) (retCode int, err error)
- func (ctx *ExecContext) QuoteCwdBuf(suffix string, cwd string, args ...string) (stdout []byte, stderr []byte, retCode int, err error)
- func (ctx *ExecContext) QuoteCwdPipeIn(suffix string, cwd string, chanStdin chan io.WriteCloser, args ...string) (retCode int, err error)
- func (ctx *ExecContext) QuoteCwdPipeInOut(suffix string, cwd string, chanStdin chan io.WriteCloser, ...) (retCode int, err error)
- func (ctx *ExecContext) QuoteCwdPipeOut(suffix string, cwd string, chanStdout chan io.Reader, args ...string) (retCode int, err error)
- func (ctx *ExecContext) QuoteDaemonCwd(suffix string, cwd string, args ...string) (pid int, retCodeChan chan int, err error)
- func (ctx *ExecContext) QuoteDaemonCwdPipeOut(suffix string, cwd string, chanStdout chan io.Reader, args ...string) (pid int, retCodeChan chan int, err error)
- func (ctx *ExecContext) QuoteShell(suffix string, s string) (retCode int, err error)
- func (ctx *ExecContext) ReadFile(p string) (b []byte, err error)
- func (ctx ExecContext) ReverseTunnel(srcAddr string, destAddr string) (listener net.Listener, errChan chan error, err error)
- func (ctx *ExecContext) Run(args ...string) (stdout []byte, stderr []byte, retCode int, err error)
- func (ctx *ExecContext) RunCwd(cwd string, args ...string) (stdout []byte, stderr []byte, retCode int, err error)
- func (ctx *ExecContext) RunShell(s string) (stdout []byte, stderr []byte, retCode int, err error)
- func (ctx *ExecContext) SessionQuoteErr(suffix string) SessionSetupFn
- func (ctx *ExecContext) SessionQuoteOut(suffix string) SessionSetupFn
- func (ctx *ExecContext) SetHostname(s string)
- func (ctx *ExecContext) SetLogPrefix(prefix string)
- func (ctx *ExecContext) SetUsername(s string)
- func (ctx *ExecContext) ShellInteractive(s string) (retCode int, err error)
- func (ctx *ExecContext) SshAddress() string
- func (ctx *ExecContext) StartCmd(session Session, hasExited chan bool) (pid int, retCodeChan chan int, err error)
- func (ctx *ExecContext) StartSession(setupFns ...SessionSetupFn) (pid int, retCodeChan chan int, err error)
- func (ctx *ExecContext) Stat(p string) (os.FileInfo, error)
- func (ctx *ExecContext) Symlink(dest string, src string) (err error)
- func (ctx *ExecContext) Uname() string
- func (ctx *ExecContext) UploadRecursiveExcludes(srcRootPath string, destContext *ExecContext, destRootPath string, ...) error
- func (ctx *ExecContext) Username() string
- func (ctx *ExecContext) WriteFile(p string, b []byte) (err error)
- type FileInfoIsh
- type FilteredReader
- type LocalSession
- func (s *LocalSession) Close() error
- func (s *LocalSession) GetFullCmdShell() string
- func (s *LocalSession) OnClose(onClose chan bool)
- func (s *LocalSession) Pid() (pid int)
- func (s *LocalSession) SetCmdArgs(args ...string)
- func (s *LocalSession) SetCmdShell(cmd string)
- func (s *LocalSession) SetCwd(cwd string)
- func (s *LocalSession) SetStdin(reader io.Reader)
- func (s *LocalSession) Start() (pid int, err error)
- func (s *LocalSession) StderrPipe() (io.Reader, error)
- func (s *LocalSession) StdoutPipe() (io.Reader, error)
- func (s *LocalSession) Wait() (retCode int, err error)
- type PseudoCloser
- type Session
- type SessionSetupFn
- func SessionArgs(args ...string) SessionSetupFn
- func SessionBuffer() (SessionSetupFn, chan []byte)
- func SessionCwd(cwd string) SessionSetupFn
- func SessionInteractive() SessionSetupFn
- func SessionPipeStdin(chanStdin chan io.WriteCloser) SessionSetupFn
- func SessionPipeStdout(chanStdout chan io.Reader) SessionSetupFn
- func SessionSetStdin(reader io.Reader) SessionSetupFn
- func SessionShell(cmd string) SessionSetupFn
- type SshSession
- func (s *SshSession) Close() error
- func (s *SshSession) GetFullCmdShell() string
- func (s *SshSession) OnClose(onClose chan bool)
- func (s *SshSession) Pid() (pid int)
- func (s *SshSession) SetCmdArgs(args ...string)
- func (s *SshSession) SetCmdShell(cmd string)
- func (s *SshSession) SetCwd(cwd string)
- func (s *SshSession) SetStdin(reader io.Reader)
- func (s *SshSession) Start() (pid int, err error)
- func (s *SshSession) StderrPipe() (io.Reader, error)
- func (s *SshSession) Wait() (retCode int, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var NotConnectedError = errors.New("not connected")
View Source
var NotFoundError = errors.New("not found")
View Source
var NotHasConnectedError = errors.New("never connected")
Functions ¶
func NewFilteredReader ¶
func SetVerbose ¶
func SetVerbose(_verbose bool)
Types ¶
type BufferCloser ¶
func (BufferCloser) Close ¶
func (b BufferCloser) Close() error
type ExecContext ¶
type ExecContext struct {
// contains filtered or unexported fields
}
func NewExecContext ¶
func NewExecContext() *ExecContext
func (*ExecContext) AbsPath ¶
func (ctx *ExecContext) AbsPath(p string) string
func (*ExecContext) Close ¶
func (ctx *ExecContext) Close()
func (*ExecContext) CloseSession ¶
func (ctx *ExecContext) CloseSession(session Session)
func (*ExecContext) Connect ¶
func (ctx *ExecContext) Connect() (err error)
func (*ExecContext) DeleteFile ¶
func (ctx *ExecContext) DeleteFile(p string) (err error)
func (*ExecContext) DeleteLink ¶
func (ctx *ExecContext) DeleteLink(p string) (err error)
func (*ExecContext) ExecSession ¶
func (ctx *ExecContext) ExecSession(setupFns ...SessionSetupFn) (retCode int, err error)
func (*ExecContext) Hostname ¶
func (ctx *ExecContext) Hostname() string
func (*ExecContext) Init ¶
func (ctx *ExecContext) Init()
func (*ExecContext) IsConnected ¶
func (ctx *ExecContext) IsConnected() bool
func (*ExecContext) IsDarwin ¶
func (ctx *ExecContext) IsDarwin() bool
func (*ExecContext) IsLinux ¶
func (ctx *ExecContext) IsLinux() bool
func (*ExecContext) IsLocal ¶
func (ctx *ExecContext) IsLocal() bool
func (*ExecContext) IsWindows ¶
func (ctx *ExecContext) IsWindows() bool
func (*ExecContext) KillAllSessions ¶
func (ctx *ExecContext) KillAllSessions()
func (*ExecContext) ListDirectory ¶
func (ctx *ExecContext) ListDirectory(path string) (files []string, err error)
func (*ExecContext) Logger ¶
func (ctx *ExecContext) Logger() *alog.Logger
func (*ExecContext) MakeSession ¶
func (ctx *ExecContext) MakeSession() (Session, error)
func (*ExecContext) Mkdirp ¶
func (ctx *ExecContext) Mkdirp(p string) (err error)
func (*ExecContext) NameAnsi ¶
func (ctx *ExecContext) NameAnsi() string
func (*ExecContext) Output ¶
func (ctx *ExecContext) Output(args ...string) (stdout string, err error)
func (*ExecContext) OutputCwd ¶
func (ctx *ExecContext) OutputCwd(cwd string, args ...string) (stdout string, err error)
func (*ExecContext) OutputShell ¶
func (ctx *ExecContext) OutputShell(s string) (stdout string, err error)
func (*ExecContext) PathExists ¶
func (ctx *ExecContext) PathExists(path string) (bool, error)
func (*ExecContext) Quote ¶
func (ctx *ExecContext) Quote(suffix string, args ...string) (retCode int, err error)
func (*ExecContext) QuoteCwdBuf ¶
func (*ExecContext) QuoteCwdPipeIn ¶
func (ctx *ExecContext) QuoteCwdPipeIn(suffix string, cwd string, chanStdin chan io.WriteCloser, args ...string) (retCode int, err error)
func (*ExecContext) QuoteCwdPipeInOut ¶
func (ctx *ExecContext) QuoteCwdPipeInOut(suffix string, cwd string, chanStdin chan io.WriteCloser, chanStdout chan io.Reader, args ...string) (retCode int, err error)
func (*ExecContext) QuoteCwdPipeOut ¶
func (*ExecContext) QuoteDaemonCwd ¶
func (*ExecContext) QuoteDaemonCwdPipeOut ¶
func (*ExecContext) QuoteShell ¶
func (ctx *ExecContext) QuoteShell(suffix string, s string) (retCode int, err error)
func (ExecContext) ReverseTunnel ¶
func (*ExecContext) SessionQuoteErr ¶
func (ctx *ExecContext) SessionQuoteErr(suffix string) SessionSetupFn
func (*ExecContext) SessionQuoteOut ¶
func (ctx *ExecContext) SessionQuoteOut(suffix string) SessionSetupFn
func (*ExecContext) SetHostname ¶
func (ctx *ExecContext) SetHostname(s string)
func (*ExecContext) SetLogPrefix ¶
func (ctx *ExecContext) SetLogPrefix(prefix string)
func (*ExecContext) SetUsername ¶
func (ctx *ExecContext) SetUsername(s string)
func (*ExecContext) ShellInteractive ¶
func (ctx *ExecContext) ShellInteractive(s string) (retCode int, err error)
func (*ExecContext) SshAddress ¶
func (ctx *ExecContext) SshAddress() string
func (*ExecContext) StartSession ¶
func (ctx *ExecContext) StartSession(setupFns ...SessionSetupFn) (pid int, retCodeChan chan int, err error)
func (*ExecContext) Uname ¶
func (ctx *ExecContext) Uname() string
func (*ExecContext) UploadRecursiveExcludes ¶
func (ctx *ExecContext) UploadRecursiveExcludes(srcRootPath string, destContext *ExecContext, destRootPath string, excludes []string) error
func (*ExecContext) Username ¶
func (ctx *ExecContext) Username() string
type FileInfoIsh ¶
type FileInfoIsh struct {
// contains filtered or unexported fields
}
func NewFileInfoIsh ¶
func NewFileInfoIsh(p string, stat string) (*FileInfoIsh, error)
func (*FileInfoIsh) IsDir ¶
func (f *FileInfoIsh) IsDir() bool
func (*FileInfoIsh) ModTime ¶
func (f *FileInfoIsh) ModTime() time.Time
func (*FileInfoIsh) Mode ¶
func (f *FileInfoIsh) Mode() os.FileMode
func (*FileInfoIsh) Name ¶
func (f *FileInfoIsh) Name() string
func (*FileInfoIsh) Size ¶
func (f *FileInfoIsh) Size() int64
func (*FileInfoIsh) Sys ¶
func (f *FileInfoIsh) Sys() interface{}
type FilteredReader ¶
type FilteredReader struct {
// contains filtered or unexported fields
}
type LocalSession ¶
func NewLocalSession ¶
func NewLocalSession() *LocalSession
func (*LocalSession) Close ¶
func (s *LocalSession) Close() error
func (*LocalSession) GetFullCmdShell ¶
func (s *LocalSession) GetFullCmdShell() string
func (*LocalSession) OnClose ¶
func (s *LocalSession) OnClose(onClose chan bool)
func (*LocalSession) Pid ¶
func (s *LocalSession) Pid() (pid int)
func (*LocalSession) SetCmdArgs ¶
func (s *LocalSession) SetCmdArgs(args ...string)
func (*LocalSession) SetCmdShell ¶
func (s *LocalSession) SetCmdShell(cmd string)
func (*LocalSession) SetCwd ¶
func (s *LocalSession) SetCwd(cwd string)
func (s *LocalSession) SetStdout(writer io.Writer) { s.Stdout = writer } func (s *LocalSession) SetStderr(writer io.Writer) { s.Stderr = writer }
func (*LocalSession) SetStdin ¶
func (s *LocalSession) SetStdin(reader io.Reader)
func (*LocalSession) Start ¶
func (s *LocalSession) Start() (pid int, err error)
func (*LocalSession) StderrPipe ¶
func (s *LocalSession) StderrPipe() (io.Reader, error)
func (*LocalSession) StdoutPipe ¶
func (s *LocalSession) StdoutPipe() (io.Reader, error)
func (*LocalSession) Wait ¶
func (s *LocalSession) Wait() (retCode int, err error)
type PseudoCloser ¶
func NewPseudoCloser ¶
func NewPseudoCloser(writer io.Writer) *PseudoCloser
func (*PseudoCloser) Close ¶
func (p *PseudoCloser) Close() error
func (*PseudoCloser) OnClose ¶
func (p *PseudoCloser) OnClose(cb func())
type Session ¶
type Session interface { Close() error OnClose(onClose chan bool) SetCwd(cwd string) GetFullCmdShell() string SetCmdShell(cmd string) SetCmdArgs(args ...string) Start() (pid int, err error) Wait() (retCode int, err error) StdinPipe() (io.WriteCloser, error) StdoutPipe() (io.Reader, error) StderrPipe() (io.Reader, error) SetStdin(reader io.Reader) Pid() int }
type SessionSetupFn ¶
func SessionArgs ¶
func SessionArgs(args ...string) SessionSetupFn
func SessionBuffer ¶
func SessionBuffer() (SessionSetupFn, chan []byte)
func SessionCwd ¶
func SessionCwd(cwd string) SessionSetupFn
func SessionInteractive ¶
func SessionInteractive() SessionSetupFn
func SessionPipeStdin ¶
func SessionPipeStdin(chanStdin chan io.WriteCloser) SessionSetupFn
func SessionPipeStdout ¶
func SessionPipeStdout(chanStdout chan io.Reader) SessionSetupFn
func SessionSetStdin ¶
func SessionSetStdin(reader io.Reader) SessionSetupFn
func SessionShell ¶
func SessionShell(cmd string) SessionSetupFn
type SshSession ¶
Extend ssh.Session so that it implements the Session interface
func NewSshSession ¶
func NewSshSession(_session *ssh.Session) *SshSession
func (*SshSession) Close ¶
func (s *SshSession) Close() error
func (*SshSession) GetFullCmdShell ¶
func (s *SshSession) GetFullCmdShell() string
func (*SshSession) OnClose ¶
func (s *SshSession) OnClose(onClose chan bool)
func (*SshSession) Pid ¶
func (s *SshSession) Pid() (pid int)
func (*SshSession) SetCmdArgs ¶
func (s *SshSession) SetCmdArgs(args ...string)
func (*SshSession) SetCmdShell ¶
func (s *SshSession) SetCmdShell(cmd string)
func (*SshSession) SetCwd ¶
func (s *SshSession) SetCwd(cwd string)
func (s *SshSession) SetStdout(writer io.Writer) { s.Stdout = writer } func (s *SshSession) SetStderr(writer io.Writer) { s.Stderr = writer }
func (*SshSession) SetStdin ¶
func (s *SshSession) SetStdin(reader io.Reader)
func (*SshSession) Start ¶
func (s *SshSession) Start() (pid int, err error)
func (*SshSession) StderrPipe ¶
func (s *SshSession) StderrPipe() (io.Reader, error)
func (*SshSession) Wait ¶
func (s *SshSession) Wait() (retCode int, err error)
Click to show internal directories.
Click to hide internal directories.