ssh

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const PlainLocalhost = Host("localhost")
View Source
const TunnelPIDPlaceholder = "<ssh tunnel pid>"

Variables

View Source
var BinaryRegex = regexp.MustCompile(`^[A-Za-z0-9_+-]+$`)

Functions

func ControlSocketPath

func ControlSocketPath(targetHost string) string

func ExecCmd

func ExecCmd(target Host, command string, stdin []byte, sshArgs ...string) *exec.Cmd

ExecCmd builds a command to be executed on the target host. If the target is localhost, it will run locally when executed. Pass stdin data as optional parameter, or nil for no stdin.

func NewSSHTunnel

func NewSSHTunnel(targetHost Host, port string, useControlSockets bool) (operation.Operation, operation.Operation, operation.Operation)

func ShellCommand

func ShellCommand(command string) string

func SplitUserHostPort

func SplitUserHostPort(raw string) (user, host, port string)

func ValidateBinaryName

func ValidateBinaryName(bin string) error

Types

type CheckSSHTunnelSecurity

type CheckSSHTunnelSecurity struct {
	TargetHost Host
	Port       string
}

func NewCheckSSHTunnelSecurity

func NewCheckSSHTunnelSecurity(targetHost Host, port string) *CheckSSHTunnelSecurity

func (*CheckSSHTunnelSecurity) Command

func (ct *CheckSSHTunnelSecurity) Command() *exec.Cmd

func (*CheckSSHTunnelSecurity) Description

func (ct *CheckSSHTunnelSecurity) Description() string

func (*CheckSSHTunnelSecurity) DryRun

func (ct *CheckSSHTunnelSecurity) DryRun(w io.Writer) error

func (*CheckSSHTunnelSecurity) Run

type Host

type Host string

func (Host) AsURI

func (h Host) AsURI() string

func (Host) IsLocalhost

func (h Host) IsLocalhost() bool

func (Host) IsPlainLocalhost

func (h Host) IsPlainLocalhost() bool

func (Host) Slugify

func (h Host) Slugify() string

type SSHTunnelProcessStop

type SSHTunnelProcessStop struct {
	Start *SSHTunnelStart
}

func NewSSHTunnelProcessStop

func NewSSHTunnelProcessStop(start *SSHTunnelStart) *SSHTunnelProcessStop

func (*SSHTunnelProcessStop) Command

func (s *SSHTunnelProcessStop) Command() *exec.Cmd

func (*SSHTunnelProcessStop) Description

func (s *SSHTunnelProcessStop) Description() string

func (*SSHTunnelProcessStop) DryRun

func (s *SSHTunnelProcessStop) DryRun(w io.Writer) error

func (*SSHTunnelProcessStop) Run

func (s *SSHTunnelProcessStop) Run(w io.Writer) error

type SSHTunnelStart

type SSHTunnelStart struct {
	TargetHost        Host
	UseControlSockets bool
	Port              string
	Process           *os.Process
}

func NewSSHTunnelStart

func NewSSHTunnelStart(targetHost Host, port string, useControlSockets bool) *SSHTunnelStart

func (*SSHTunnelStart) Command

func (s *SSHTunnelStart) Command() *exec.Cmd

func (*SSHTunnelStart) Description

func (s *SSHTunnelStart) Description() string

func (*SSHTunnelStart) DryRun

func (s *SSHTunnelStart) DryRun(w io.Writer) error

func (*SSHTunnelStart) Run

func (s *SSHTunnelStart) Run(w io.Writer) error

type SSHTunnelStop

type SSHTunnelStop struct {
	TargetHost Host
}

func NewSSHTunnelStop

func NewSSHTunnelStop(targetHost Host) *SSHTunnelStop

func (*SSHTunnelStop) Command

func (s *SSHTunnelStop) Command() *exec.Cmd

func (*SSHTunnelStop) Description

func (s *SSHTunnelStop) Description() string

func (*SSHTunnelStop) DryRun

func (s *SSHTunnelStop) DryRun(w io.Writer) error

func (*SSHTunnelStop) Run

func (s *SSHTunnelStop) Run(w io.Writer) error

Jump to

Keyboard shortcuts

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