Documentation
¶
Index ¶
- Constants
- Variables
- func ClassifyStderr(stderr string) error
- func ControlSocketPath(targetHost string) string
- func ExecCmd(target Destination, command string, stdin []byte, sshArgs ...string) *exec.Cmd
- func NewSSHTunnel(targetDest Destination, port string, useControlSockets bool) (operation.Operation, operation.Operation, operation.Operation)
- func ShellCommand(command string) string
- func SplitUserHostPort(raw string) (user, host, port string)
- type CheckSSHTunnelSecurity
- type Config
- type Destination
- type SSHTunnelProcessStop
- type SSHTunnelStart
- type SSHTunnelStop
Constants ¶
View Source
const TunnelPIDPlaceholder = "<ssh tunnel pid>"
Variables ¶
View Source
var ( ErrSSH = errors.New("SSH failed") ErrAuthFailed = fmt.Errorf("%w: authentication failed", ErrSSH) ErrConnectionFailed = fmt.Errorf("%w: connection failed", ErrSSH) )
View Source
var PlainLocalhost = Destination{Host: "localhost"}
Functions ¶
func ClassifyStderr ¶ added in v1.4.0
ClassifyStderr inspects SSH stderr output and returns a typed error when a known failure pattern is detected, or nil if the output is unrecognised.
func ControlSocketPath ¶
func ExecCmd ¶
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 ShellCommand ¶
func SplitUserHostPort ¶
Types ¶
type CheckSSHTunnelSecurity ¶
type CheckSSHTunnelSecurity struct {
TargetDest Destination
Port string
}
func NewCheckSSHTunnelSecurity ¶
func NewCheckSSHTunnelSecurity(targetDest Destination, port string) *CheckSSHTunnelSecurity
func (*CheckSSHTunnelSecurity) Command ¶
func (ct *CheckSSHTunnelSecurity) Command() *exec.Cmd
func (*CheckSSHTunnelSecurity) Description ¶
func (ct *CheckSSHTunnelSecurity) Description() string
type Config ¶ added in v1.4.0
type Config struct {
HostName string
// contains filtered or unexported fields
}
func NewConfig ¶ added in v1.4.0
func NewConfig(dest Destination) Config
func NewConfigFromBytes ¶ added in v1.4.0
type Destination ¶ added in v1.4.0
func NewDestination ¶ added in v1.4.0
func NewDestination(destStr string) Destination
func (Destination) AsURI ¶ added in v1.4.0
func (d Destination) AsURI() string
func (Destination) IsLocalhost ¶ added in v1.4.0
func (d Destination) IsLocalhost() bool
func (Destination) IsPlainLocalhost ¶ added in v1.4.0
func (d Destination) IsPlainLocalhost() bool
func (Destination) Slugify ¶ added in v1.4.0
func (d Destination) Slugify() string
func (Destination) String ¶ added in v1.4.0
func (d Destination) String() 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
type SSHTunnelStart ¶
type SSHTunnelStart struct {
TargetDest Destination
UseControlSockets bool
Port string
Process *os.Process
}
func NewSSHTunnelStart ¶
func NewSSHTunnelStart(targetDest Destination, port string, useControlSockets bool) *SSHTunnelStart
func (*SSHTunnelStart) Command ¶
func (s *SSHTunnelStart) Command() *exec.Cmd
func (*SSHTunnelStart) Description ¶
func (s *SSHTunnelStart) Description() string
type SSHTunnelStop ¶
type SSHTunnelStop struct {
TargetDest Destination
}
func NewSSHTunnelStop ¶
func NewSSHTunnelStop(targetDest Destination) *SSHTunnelStop
func (*SSHTunnelStop) Command ¶
func (s *SSHTunnelStop) Command() *exec.Cmd
func (*SSHTunnelStop) Description ¶
func (s *SSHTunnelStop) Description() string
Click to show internal directories.
Click to hide internal directories.