sshexec

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptNewHostKeyCallback

func AcceptNewHostKeyCallback(knownHostsPath string) (ssh.HostKeyCallback, error)

AcceptNewHostKeyCallback behaves like OpenSSH StrictHostKeyChecking=accept-new: unknown keys are appended to knownHostsPath; mismatches are rejected.

func AuthMethods

func AuthMethods(identityPath string) ([]ssh.AuthMethod, error)

AuthMethods returns SSH auth methods: optional identity file (if readable), then ssh-agent.

func Dial

func Dial(cfg *config.Config) (*ssh.Client, error)

Dial opens an SSH client using cfg (remote_ssh, ssh_identity) and accept-new known_hosts.

func JoinShell

func JoinShell(parts []string) string

JoinShell joins already shell-quoted fragments with spaces.

func ParseUserHost

func ParseUserHost(remoteSSH string) (user, address string, err error)

ParseUserHost parses remote_ssh as user@host or user@host:port or user@[ipv6]:port.

func QuoteArgs

func QuoteArgs(args []string) string

QuoteArgs shell-quotes each argument and joins.

func RunBash

func RunBash(client *ssh.Client, script string, tty bool) error

RunBash runs bash -lc script on the SSH connection.

func RunBashOpts

func RunBashOpts(client *ssh.Client, script string, tty bool, opts BashOpts) error

RunBashOpts is like RunBash with extra options for TTY sessions.

func RunRemotePipe

func RunRemotePipe(client *ssh.Client, script string, stdin io.Reader) error

RunRemotePipe runs bash -lc script with stdin connected (e.g. docker save | ssh … docker load).

func ShellQuote

func ShellQuote(s string) string

ShellQuote returns s safe for POSIX sh single-quoted strings.

Types

type BashOpts

type BashOpts struct {
	// RawLocalStdin puts the client's stdin in raw mode so keys (e.g. Ctrl+D / EOT) reach the remote shell.
	RawLocalStdin bool
	// CloseSessionOnInterrupt ends the SSH session on local Ctrl+C / SIGTERM instead of forwarding
	// ssh.SIGINT to the remote shell. Use for dq logs -f: dropping the session stops log streaming.
	// Do not set for dq exec -it, where SIGINT must reach the container shell.
	CloseSessionOnInterrupt bool
}

BashOpts tweaks interactive (TTY) SSH sessions (e.g. dq exec, dq logs -f).

Jump to

Keyboard shortcuts

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