ssh

package
v0.0.0-...-9971314 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGlobalHelper

func NewGlobalHelper(opts ...Option) error

Types

type DialClient

type DialClient interface {
	NewSession() (*ssh.Session, error)
	Close() error
}

type Helper

type Helper struct {
	SshClientPtr *ssh.Client
	DialClient
	SessionClient
	SftpClient
	Options
}

func GetGlobalHelper

func GetGlobalHelper() *Helper

func NewHelper

func NewHelper(opts ...Option) (*Helper, error)

func (*Helper) Close

func (h *Helper) Close()

func (*Helper) Copy

func (h *Helper) Copy(srcPath, dstPath string) error

func (*Helper) Run

func (h *Helper) Run(cmd string) error

func (*Helper) SetClients

func (h *Helper) SetClients() error

type Option

type Option func(*Options)

func AuthMethod

func AuthMethod(method ssh.AuthMethod) Option

func Host

func Host(host string) Option

func HostKeyCallback

func HostKeyCallback(callback ssh.HostKeyCallback) Option

func Timeout

func Timeout(timeout time.Duration) Option

func User

func User(user string) Option

type Options

type Options struct {
	Host            string
	User            string
	AuthMethod      ssh.AuthMethod
	HostKeyCallback ssh.HostKeyCallback
	Timeout         time.Duration
}

type SessionClient

type SessionClient interface {
	Run(string) error
	Close() error
}

type SftpClient

type SftpClient interface {
	Create(string) (*sftp.File, error)
}

Jump to

Keyboard shortcuts

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