ssh

package
v1.1.14 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.1.11

type Client struct {
	SshClientConfig *ssh.ClientConfig
	SshUrl          string
}

Client is an ssh wrapper to dialog with a sftp server.

func NewClient added in v1.1.11

func NewClient(cfg *Config) (*Client, error)

Client constructor.

func (*Client) ExecCmd added in v1.1.11

func (c *Client) ExecCmd(connectPath string, cmd string) error

ExecCmd will remotely execute a command.

func (*Client) SendFile added in v1.1.11

func (c *Client) SendFile(sourceFilePath string, destDirPath string) error

SendFile sends a file from a source path to the destination directory with the same name.

type Config

type Config struct {
	User       string `yaml:"user"`
	Host       string `yaml:"host"`
	Port       string `yaml:"port"`
	SshKeyPath string `yaml:"sshKeyPath"`
}

Config is the configuration structure used by an ssh client.

func (Config) GetSshClientConfig

func (c Config) GetSshClientConfig() (*ssh.ClientConfig, error)

GetSshClientConfig loads and parses a private key to return an ssh client config.

type RemoteAccess added in v1.1.11

type RemoteAccess interface {
	SendFile(sourcePath string, destPath string) error
	ExecCmd(connectPath string, cmd string) error
}

RemoteAccess interface defines the methods a concrete remote accessor must implement.

Jump to

Keyboard shortcuts

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