ssh

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(data map[string]any, opts ...Option) (map[string]any, error)

func PrepareRequestData

func PrepareRequestData(data map[string]any) error

PrepareRequestData prepares SSH request data by extracting environment variables

Types

type Callback

type Callback struct {
	// contains filtered or unexported fields
}

type Option

type Option func(*Callback)

func WithAfter

func WithAfter(f func(result *Result)) Option

func WithBefore

func WithBefore(f func(host string, port int, user string, cmd string)) Option

type Req

type Req struct {
	Host            string            `map:"host" validate:"required"`
	Port            int               `map:"port"`
	User            string            `map:"user" validate:"required"`
	Cmd             string            `map:"cmd" validate:"required"`
	Password        string            `map:"password"`
	KeyFile         string            `map:"key_file"`
	KeyPassphrase   string            `map:"key_passphrase"`
	Timeout         string            `map:"timeout"`
	Workdir         string            `map:"workdir"`
	Env             map[string]string `map:"env"`
	StrictHostCheck bool              `map:"strict_host_check"`
	KnownHosts      string            `map:"known_hosts"`
	// contains filtered or unexported fields
}

func NewReq

func NewReq() *Req

func (*Req) Do

func (r *Req) Do() (re *Result, er error)

type Res

type Res struct {
	Code   int    `map:"code"`
	Stdout string `map:"stdout"`
	Stderr string `map:"stderr"`
}

type Result

type Result struct {
	Req    Req           `map:"req"`
	Res    Res           `map:"res"`
	RT     time.Duration `map:"rt"`
	Status int           `map:"status"`
}

Jump to

Keyboard shortcuts

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