Documentation
¶
Index ¶
- func CheckLocalPath(path string) (string, error)
- func CreateEmptyTmpFile(sett settings.Settings) (string, error)
- type Agent
- 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) IsStopped() bool
- func (s *Client) KubeProxy() connection.KubeProxy
- func (s *Client) Loop(fn connection.SSHLoopHandler) 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) UploadScript(scriptPath string, args ...string) connection.Script
- func (s *Client) WithID(id string) *Client
- type Command
- func (c *Command) Cmd(ctx context.Context)
- func (c *Command) CombinedOutput(ctx context.Context) ([]byte, error)
- func (c *Command) OnCommandStart(fn func())
- func (c *Command) Output(ctx context.Context) ([]byte, []byte, error)
- func (c *Command) Sudo(ctx context.Context)
- func (c *Command) WithEnv(env map[string]string)
- func (c *Command) WithSSHArgs(args ...string)
- func (c *Command) WithTimeout(timeout time.Duration)
- type File
- func (f *File) Download(ctx context.Context, remotePath, dstPath string) error
- func (f *File) DownloadBytes(ctx context.Context, remotePath string) ([]byte, error)
- func (f *File) Upload(ctx context.Context, srcPath, remotePath string) error
- func (f *File) UploadBytes(ctx context.Context, data []byte, remotePath string) error
- type KubeProxy
- type ReverseTunnel
- type Tunnel
- type UploadScript
- func (u *UploadScript) Execute(ctx context.Context) ([]byte, error)
- func (u *UploadScript) ExecuteBundle(ctx context.Context, parentDir, bundleDir string) ([]byte, error)
- func (u *UploadScript) IsSudo() bool
- func (u *UploadScript) Settings() settings.Settings
- func (u *UploadScript) Sudo()
- func (u *UploadScript) UploadDir() string
- func (u *UploadScript) WithBundlerOpts(opts ...connection.BundlerOption)
- func (u *UploadScript) WithCleanupAfterExec(doCleanup bool)
- func (u *UploadScript) WithEnvs(envs map[string]string)
- func (u *UploadScript) WithExecuteUploadDir(dir string)
- func (u *UploadScript) WithNoLogStepOutOnError(enabled bool)
- func (u *UploadScript) WithStdoutHandler(handler func(string))
- func (u *UploadScript) WithTimeout(timeout time.Duration)
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 Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
func NewAgent ¶
func NewAgent(sshSettings settings.Settings, agentSettings *session.AgentSettings) *Agent
type Client ¶
type Client struct {
SessionSettings *session.Session
Agent *Agent
InitializeNewAgent bool
// 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) UploadScript ¶
func (s *Client) UploadScript(scriptPath string, args ...string) connection.Script
UploadScript is used to upload script and execute it on remote server
type Command ¶
type Command struct {
*process.Executor
Session *session.Session
Name string
Args []string
Env []string
SSHArgs []string
// contains filtered or unexported fields
}
func NewCommand ¶
func (*Command) CombinedOutput ¶
func (*Command) OnCommandStart ¶
func (c *Command) OnCommandStart(fn func())
func (*Command) WithSSHArgs ¶
func (*Command) WithTimeout ¶
type File ¶
func (*File) DownloadBytes ¶
Download remote file and returns its content as an array of bytes.
type ReverseTunnel ¶
type ReverseTunnel struct {
Session *session.Session
Address string
// contains filtered or unexported fields
}
func NewReverseTunnel ¶
func (*ReverseTunnel) StartHealthMonitor ¶
func (t *ReverseTunnel) StartHealthMonitor(ctx context.Context, checker connection.ReverseTunnelChecker, killer 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 Tunnel ¶
type Tunnel struct {
Session *session.Session
Type string // Remote or Local
Address string
// contains filtered or unexported fields
}
func (*Tunnel) HealthMonitor ¶
type UploadScript ¶
type UploadScript struct {
ScriptPath string
Args []string
// contains filtered or unexported fields
}
func NewUploadScript ¶
func (*UploadScript) ExecuteBundle ¶
func (*UploadScript) IsSudo ¶
func (u *UploadScript) IsSudo() bool
func (*UploadScript) Settings ¶
func (u *UploadScript) Settings() settings.Settings
func (*UploadScript) Sudo ¶
func (u *UploadScript) Sudo()
func (*UploadScript) UploadDir ¶
func (u *UploadScript) UploadDir() string
func (*UploadScript) WithBundlerOpts ¶
func (u *UploadScript) WithBundlerOpts(opts ...connection.BundlerOption)
func (*UploadScript) WithCleanupAfterExec ¶
func (u *UploadScript) 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 (*UploadScript) WithEnvs ¶
func (u *UploadScript) WithEnvs(envs map[string]string)
func (*UploadScript) WithExecuteUploadDir ¶
func (u *UploadScript) WithExecuteUploadDir(dir string)
func (*UploadScript) WithNoLogStepOutOnError ¶
func (u *UploadScript) WithNoLogStepOutOnError(enabled bool)
func (*UploadScript) WithStdoutHandler ¶
func (u *UploadScript) WithStdoutHandler(handler func(string))
func (*UploadScript) WithTimeout ¶
func (u *UploadScript) WithTimeout(timeout time.Duration)