ssh

package
v0.0.0-...-1f53b64 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialWithTimeout

func DialWithTimeout(network, addr string, config *gossh.ClientConfig) (*gossh.Client, error)

Types

type ConnInfo

type ConnInfo struct {
	User        string        `json:"user"`
	Addr        string        `json:"addr"`
	Port        int           `json:"port"`
	AuthMode    string        `json:"authMode"`
	Password    string        `json:"password"`
	PrivateKey  []byte        `json:"privateKey"`
	PassPhrase  []byte        `json:"passPhrase"`
	DialTimeOut time.Duration `json:"dialTimeOut"`
}

type SSHClient

type SSHClient struct {
	Client   *gossh.Client `json:"client"`
	SudoItem string        `json:"sudoItem"`
}

func NewClient

func NewClient(c ConnInfo) (*SSHClient, error)

func (*SSHClient) Close

func (c *SSHClient) Close()

func (*SSHClient) CpFileWithCheck

func (c *SSHClient) CpFileWithCheck(src, dst string) error

func (*SSHClient) IsRoot

func (c *SSHClient) IsRoot(user string) bool

func (*SSHClient) Run

func (c *SSHClient) Run(shell string) (string, error)

func (*SSHClient) RunWithStreamOutput

func (c *SSHClient) RunWithStreamOutput(command string, outputCallback func(string)) error

func (*SSHClient) Runf

func (c *SSHClient) Runf(shell string, args ...interface{}) (string, error)

func (*SSHClient) SudoHandleCmd

func (c *SSHClient) SudoHandleCmd() string

Jump to

Keyboard shortcuts

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