Documentation
¶
Index ¶
- func WrapCommand(cmd, activeCwd, sudoPassword string) (fullShellCmd, markerExit, markerCwd string)
- type Client
- func (c *Client) Close()
- func (c *Client) Connect() error
- func (c *Client) ConnectTo(host string, port int, user, keyPath, password, sudoPassword string) error
- func (c *Client) DownloadFile(remotePath, localPath string, overwrite bool) (int64, error)
- func (c *Client) EnsureConnected() error
- func (c *Client) ExecRaw(cmd string) (string, string, int, error)
- func (c *Client) GetCwd() string
- func (c *Client) GetSudoPassword() string
- func (c *Client) HasSudoPassword() bool
- func (c *Client) Herdr() *herdr.Manager
- func (c *Client) Host() string
- func (c *Client) IsConnected() bool
- func (c *Client) ListDir(remotePath string) ([]DirEntryInfo, error)
- func (c *Client) ReplaceFileContent(remotePath string, targetContent, replacementContent string, ...) (*ReplaceResult, error)
- func (c *Client) ResolvePath(p string) string
- func (c *Client) RunCommand(cmd string, targetCwd string, isDaemon bool, waitMs int, ...) (*ExecResult, error)
- func (c *Client) SFTP() (*sftp.Client, error)
- func (c *Client) SSH() (*ssh.Client, error)
- func (c *Client) SetCwd(newCwd string)
- func (c *Client) SetSudoPassword(password string)
- func (c *Client) TaskManager() *TaskManager
- func (c *Client) TunnelManager() *TunnelManager
- func (c *Client) UploadFile(localPath, remotePath string, overwrite bool) (int64, error)
- func (c *Client) User() string
- func (c *Client) ViewFile(remotePath string, startLine, endLine int, offset int, maxBytes int) (*ViewResult, error)
- func (c *Client) WriteFile(remotePath string, content []byte, overwrite bool) error
- type CommandOptions
- type DirEntryInfo
- type ExecResult
- type ReplaceResult
- type Task
- type TaskManager
- type Tunnel
- type TunnelManager
- type ViewResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapCommand ¶
WrapCommand prepares a shell command to execute inside a POSIX subshell (/bin/sh or sh) safely from ANY remote login shell (including fish, zsh, csh, tcsh, bash, ash, dash). It encodes the command via Base64 to guarantee complete character/quote/variable safety across all remote login shells. If sudoPassword is provided, it automatically configures a secure SUDO_ASKPASS wrapper so that any sudo invocation runs non-interactively without requiring a TTY or manual password prompts.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DownloadFile ¶
func (*Client) EnsureConnected ¶
func (*Client) ExecRaw ¶
ExecRaw executes a remote command directly over an SSH session without wrappers. It returns stdout, stderr, exit code, and any transport error.
func (*Client) GetSudoPassword ¶
func (*Client) HasSudoPassword ¶
func (*Client) IsConnected ¶
func (*Client) ReplaceFileContent ¶
func (*Client) ResolvePath ¶
func (*Client) RunCommand ¶
func (c *Client) RunCommand(cmd string, targetCwd string, isDaemon bool, waitMs int, opts ...CommandOptions) (*ExecResult, error)
func (*Client) SetSudoPassword ¶
func (*Client) TaskManager ¶
func (c *Client) TaskManager() *TaskManager
func (*Client) TunnelManager ¶
func (c *Client) TunnelManager() *TunnelManager
func (*Client) UploadFile ¶
type CommandOptions ¶
type DirEntryInfo ¶
type ExecResult ¶
type ReplaceResult ¶
type Task ¶
type TaskManager ¶
type TaskManager struct {
// contains filtered or unexported fields
}
func NewTaskManager ¶
func NewTaskManager() *TaskManager
func (*TaskManager) Kill ¶
func (tm *TaskManager) Kill(id string) error
func (*TaskManager) List ¶
func (tm *TaskManager) List() []*Task
func (*TaskManager) Register ¶
func (tm *TaskManager) Register(cmd, cwd string, sess *ssh.Session, stdin io.WriteCloser, stdout, stderr *syncBuffer) *Task
type TunnelManager ¶
type TunnelManager struct {
// contains filtered or unexported fields
}
func NewTunnelManager ¶
func NewTunnelManager(sshClientGetter func() (*ssh.Client, error)) *TunnelManager
func (*TunnelManager) Close ¶
func (tm *TunnelManager) Close(id string) error
func (*TunnelManager) CloseAll ¶
func (tm *TunnelManager) CloseAll()
func (*TunnelManager) List ¶
func (tm *TunnelManager) List() []*Tunnel
Click to show internal directories.
Click to hide internal directories.