Documentation
¶
Index ¶
- func CheckLocalPath(path string) (string, error)
- func CopyFile(ctx context.Context, fileReader io.Reader, remotePath string, ...) error
- func CreateEmptyTmpFile(sett settings.Settings) (string, error)
- type Client
- func (s *Client) Check() connection.Check
- func (s *Client) Command(name string, arg ...string) connection.Command
- func (s *Client) File() connection.File
- func (s *Client) GetClient() *gossh.Client
- func (s *Client) IsStopped() bool
- func (s *Client) KubeProxy() connection.KubeProxy
- func (s *Client) Live() bool
- func (s *Client) Loop(fn connection.SSHLoopHandler) error
- func (s *Client) NewSSHSession() (*gossh.Session, error)
- func (s *Client) OnlyPreparePrivateKeys() error
- func (s *Client) PrivateKeys() []session.AgentPrivateKey
- func (s *Client) RefreshPrivateKeys() error
- func (s *Client) ReverseTunnel(address string) connection.ReverseTunnel
- func (s *Client) Session() *session.Session
- func (s *Client) Settings() settings.Settings
- func (s *Client) Start() error
- func (s *Client) Stop()
- func (s *Client) Tunnel(address string) connection.Tunnel
- func (s *Client) UnregisterSession(sess *gossh.Session)
- func (s *Client) UploadScript(scriptPath string, args ...string) connection.Script
- func (s *Client) WithID(id string) *Client
- func (s *Client) WithLoopsParams(p ClientLoopsParams) *Client
- type ClientLoopsParams
- type KubeProxy
- type PassThru
- type ReverseTunnel
- type SSHCommand
- func (c *SSHCommand) CaptureStderr(buf *bytes.Buffer) *SSHCommand
- func (c *SSHCommand) CaptureStdout(buf *bytes.Buffer) *SSHCommand
- func (c *SSHCommand) Cmd(ctx context.Context)
- func (c *SSHCommand) CombinedOutput(ctx context.Context) ([]byte, error)
- func (c *SSHCommand) ConsumeLines(r io.Reader, fn func(l string))
- func (c *SSHCommand) OnCommandStart(fn func())
- func (c *SSHCommand) OpenStdinPipe() *SSHCommand
- func (c *SSHCommand) Output(ctx context.Context) ([]byte, []byte, error)
- func (c *SSHCommand) ProcessWait()
- func (c *SSHCommand) Run(ctx context.Context) error
- func (c *SSHCommand) SetupStreamHandlers() error
- func (c *SSHCommand) Start() error
- func (c *SSHCommand) StderrBytes() []byte
- func (c *SSHCommand) StdoutBytes() []byte
- func (c *SSHCommand) Stop()
- func (c *SSHCommand) Sudo(ctx context.Context)
- func (c *SSHCommand) WaitError() error
- func (c *SSHCommand) WithEnv(env map[string]string)
- func (c *SSHCommand) WithMatchHandler(fn func(pattern string) string) *SSHCommand
- func (c *SSHCommand) WithMatchers(matchers ...*utils.ByteSequenceMatcher) *SSHCommand
- func (c *SSHCommand) WithSSHArgs(args ...string)
- func (c *SSHCommand) WithStderrHandler(handler func(string))
- func (c *SSHCommand) WithStdoutHandler(handler func(string))
- func (c *SSHCommand) WithTimeout(timeout time.Duration)
- func (c *SSHCommand) WithWaitHandler(waitHandler func(error)) *SSHCommand
- type SSHFile
- func (f *SSHFile) Download(ctx context.Context, remotePath, dstPath string) error
- func (f *SSHFile) DownloadBytes(ctx context.Context, remotePath string) ([]byte, error)
- func (f *SSHFile) Upload(ctx context.Context, srcPath, remotePath string) error
- func (f *SSHFile) UploadBytes(ctx context.Context, data []byte, remotePath string) error
- type SSHUploadScript
- func (u *SSHUploadScript) Execute(ctx context.Context) ([]byte, error)
- func (u *SSHUploadScript) ExecuteBundle(ctx context.Context, parentDir, bundleDir string) ([]byte, error)
- func (u *SSHUploadScript) IsSudo() bool
- func (u *SSHUploadScript) Settings() settings.Settings
- func (u *SSHUploadScript) Sudo()
- func (u *SSHUploadScript) UploadDir() string
- func (u *SSHUploadScript) WithBundlerOpts(opts ...connection.BundlerOption)
- func (u *SSHUploadScript) WithCleanupAfterExec(doCleanup bool)
- func (u *SSHUploadScript) WithEnvs(envs map[string]string)
- func (u *SSHUploadScript) WithExecuteUploadDir(dir string)
- func (u *SSHUploadScript) WithNoLogStepOutOnError(enabled bool)
- func (u *SSHUploadScript) WithStdoutHandler(handler func(string))
- func (u *SSHUploadScript) WithTimeout(timeout time.Duration)
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLocalPath ¶
CheckLocalPath see if file exists and determine if it is a directory. Error is returned if file is not exists.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Check ¶
func (s *Client) Check() connection.Check
Check is used to upload script and execute it on remote server
func (*Client) Command ¶
func (s *Client) Command(name string, arg ...string) connection.Command
Command is used to run commands on remote server
func (*Client) File ¶
func (s *Client) File() connection.File
File is used to upload and download files and directories
func (*Client) KubeProxy ¶
func (s *Client) KubeProxy() connection.KubeProxy
KubeProxy is used to start kubectl proxy and create a tunnel from local port to proxy port
func (*Client) Loop ¶
func (s *Client) Loop(fn connection.SSHLoopHandler) error
Loop Looping all available hosts
func (*Client) OnlyPreparePrivateKeys ¶
func (*Client) PrivateKeys ¶
func (s *Client) PrivateKeys() []session.AgentPrivateKey
func (*Client) RefreshPrivateKeys ¶
func (*Client) ReverseTunnel ¶
func (s *Client) ReverseTunnel(address string) connection.ReverseTunnel
ReverseTunnel is used to open remote (R) tunnel
func (*Client) Tunnel ¶
func (s *Client) Tunnel(address string) connection.Tunnel
Tunnel is used to open local (L) and remote (R) tunnels
func (*Client) UnregisterSession ¶
func (*Client) UploadScript ¶
func (s *Client) UploadScript(scriptPath string, args ...string) connection.Script
UploadScript is used to upload script and execute it on remote server
func (*Client) WithLoopsParams ¶
func (s *Client) WithLoopsParams(p ClientLoopsParams) *Client
type ClientLoopsParams ¶
type ReverseTunnel ¶
type ReverseTunnel struct {
// contains filtered or unexported fields
}
func NewReverseTunnel ¶
func NewReverseTunnel(sshClient *Client, address string) *ReverseTunnel
func (*ReverseTunnel) StartHealthMonitor ¶
func (t *ReverseTunnel) StartHealthMonitor(ctx context.Context, checker connection.ReverseTunnelChecker, _ connection.ReverseTunnelKiller)
func (*ReverseTunnel) Stop ¶
func (t *ReverseTunnel) Stop()
func (*ReverseTunnel) String ¶
func (t *ReverseTunnel) String() string
func (*ReverseTunnel) Up ¶
func (t *ReverseTunnel) Up() error
type SSHCommand ¶
type SSHCommand struct {
Name string
Args []string
Env []string
SSHArgs []string
StdoutSplitter bufio.SplitFunc
StdinPipe bool
Stdin io.WriteCloser
Matchers []*utils.ByteSequenceMatcher
MatchHandler func(pattern string) string
WaitHandler func(err error)
OutBytes bytes.Buffer
ErrBytes bytes.Buffer
Cancel func() error
// contains filtered or unexported fields
}
func NewSSHCommand ¶
func NewSSHCommand(client *Client, name string, arg ...string) *SSHCommand
func (*SSHCommand) CaptureStderr ¶
func (c *SSHCommand) CaptureStderr(buf *bytes.Buffer) *SSHCommand
func (*SSHCommand) CaptureStdout ¶
func (c *SSHCommand) CaptureStdout(buf *bytes.Buffer) *SSHCommand
func (*SSHCommand) Cmd ¶
func (c *SSHCommand) Cmd(ctx context.Context)
func (*SSHCommand) CombinedOutput ¶
func (c *SSHCommand) CombinedOutput(ctx context.Context) ([]byte, error)
func (*SSHCommand) ConsumeLines ¶
func (c *SSHCommand) ConsumeLines(r io.Reader, fn func(l string))
func (*SSHCommand) OnCommandStart ¶
func (c *SSHCommand) OnCommandStart(fn func())
func (*SSHCommand) OpenStdinPipe ¶
func (c *SSHCommand) OpenStdinPipe() *SSHCommand
func (*SSHCommand) ProcessWait ¶
func (c *SSHCommand) ProcessWait()
func (*SSHCommand) SetupStreamHandlers ¶
func (c *SSHCommand) SetupStreamHandlers() error
func (*SSHCommand) Start ¶
func (c *SSHCommand) Start() error
func (*SSHCommand) StderrBytes ¶
func (c *SSHCommand) StderrBytes() []byte
func (*SSHCommand) StdoutBytes ¶
func (c *SSHCommand) StdoutBytes() []byte
func (*SSHCommand) Stop ¶
func (c *SSHCommand) Stop()
func (*SSHCommand) Sudo ¶
func (c *SSHCommand) Sudo(ctx context.Context)
func (*SSHCommand) WaitError ¶
func (c *SSHCommand) WaitError() error
func (*SSHCommand) WithEnv ¶
func (c *SSHCommand) WithEnv(env map[string]string)
func (*SSHCommand) WithMatchHandler ¶
func (c *SSHCommand) WithMatchHandler(fn func(pattern string) string) *SSHCommand
func (*SSHCommand) WithMatchers ¶
func (c *SSHCommand) WithMatchers(matchers ...*utils.ByteSequenceMatcher) *SSHCommand
func (*SSHCommand) WithSSHArgs ¶
func (c *SSHCommand) WithSSHArgs(args ...string)
func (*SSHCommand) WithStderrHandler ¶
func (c *SSHCommand) WithStderrHandler(handler func(string))
func (*SSHCommand) WithStdoutHandler ¶
func (c *SSHCommand) WithStdoutHandler(handler func(string))
func (*SSHCommand) WithTimeout ¶
func (c *SSHCommand) WithTimeout(timeout time.Duration)
func (*SSHCommand) WithWaitHandler ¶
func (c *SSHCommand) WithWaitHandler(waitHandler func(error)) *SSHCommand
type SSHFile ¶
type SSHFile struct {
// contains filtered or unexported fields
}
func (*SSHFile) DownloadBytes ¶
Download remote file and returns its content as an array of bytes.
type SSHUploadScript ¶
type SSHUploadScript struct {
ScriptPath string
Args []string
// contains filtered or unexported fields
}
func NewSSHUploadScript ¶
func NewSSHUploadScript(sshClient *Client, scriptPath string, args ...string) *SSHUploadScript
func (*SSHUploadScript) Execute ¶
func (u *SSHUploadScript) Execute(ctx context.Context) ([]byte, error)
func (*SSHUploadScript) ExecuteBundle ¶
func (*SSHUploadScript) IsSudo ¶
func (u *SSHUploadScript) IsSudo() bool
func (*SSHUploadScript) Settings ¶
func (u *SSHUploadScript) Settings() settings.Settings
func (*SSHUploadScript) Sudo ¶
func (u *SSHUploadScript) Sudo()
func (*SSHUploadScript) UploadDir ¶
func (u *SSHUploadScript) UploadDir() string
func (*SSHUploadScript) WithBundlerOpts ¶
func (u *SSHUploadScript) WithBundlerOpts(opts ...connection.BundlerOption)
func (*SSHUploadScript) WithCleanupAfterExec ¶
func (u *SSHUploadScript) WithCleanupAfterExec(doCleanup bool)
WithCleanupAfterExec option tells if ssh executor should delete uploaded script after execution was attempted or not. It does not care if script was executed successfully of failed.
func (*SSHUploadScript) WithEnvs ¶
func (u *SSHUploadScript) WithEnvs(envs map[string]string)
func (*SSHUploadScript) WithExecuteUploadDir ¶
func (u *SSHUploadScript) WithExecuteUploadDir(dir string)
func (*SSHUploadScript) WithNoLogStepOutOnError ¶
func (u *SSHUploadScript) WithNoLogStepOutOnError(enabled bool)
func (*SSHUploadScript) WithStdoutHandler ¶
func (u *SSHUploadScript) WithStdoutHandler(handler func(string))
func (*SSHUploadScript) WithTimeout ¶
func (u *SSHUploadScript) WithTimeout(timeout time.Duration)
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}