ssh

package module
v0.0.0-...-9b2e7d9 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ResizeEvent syscall.Signal = syscall.SIGWINCH

ResizeEvent is syscall resize event.

Variables

View Source
var Fd int = int(os.Stdin.Fd())

Fd is file descriptor to get terminal size.

Functions

This section is empty.

Types

type Client

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

Client is used to run commands and set up environment variables in the remote.

func Connect

func Connect(network string, remoteAddr *util.Remote, config *ssh.ClientConfig) (*Client, error)

Connect connects to remote with given network, address and client configuration.

func ConnectAuto

func ConnectAuto(remote *util.Remote) (*Client, error)

ConnectAuto tries to connect with all available methods. The sequence is SSH Agent, public key, password

func ConnectWithPassword

func ConnectWithPassword(remote *util.Remote) (*Client, error)

ConnectWithPassword connect to the remote and prompts user for password.

func ConnectWithSshAgent

func ConnectWithSshAgent(remote *util.Remote) (*Client, error)

ConnectWithSshAgent tries to connect to remote using sshagent. Only available on unix systems.

func (*Client) CopyFileFromRemote

func (client *Client) CopyFileFromRemote(remoteFile string, localFile string) error

CopyFileFromRemote copies file from the remote to local over SSH.

func (*Client) CopyFileToRemote

func (client *Client) CopyFileToRemote(localFile string, remoteFile string) error

CopyFileToRemote copies local file to remote over SSH.

func (*Client) Disconnect

func (client *Client) Disconnect() error

Disconnect disconnects the client.

func (*Client) MoveFileAtRemote

func (client *Client) MoveFileAtRemote(from string, to string) error

MoveFileAtRemote moves file in remote from location to another.

func (*Client) RunCommand

func (client *Client) RunCommand(cmd string, stdIn, stdOut, stdErr *os.File) error

RunCommand runs single command in the remote.

func (*Client) SetRemoteEnv

func (client *Client) SetRemoteEnv(name string, value string)

SetRemoteEnv sets remote environment variable that will be set when interactive session is started with StartInteractiveSession.

func (*Client) SetRemoteEnvMap

func (client *Client) SetRemoteEnvMap(envVariables map[string]string)

SetRemoteEnvMap sets remote environment variables from map that will be set when interactive session is started with StartInteractiveSession.

func (*Client) StartInteractiveSession

func (client *Client) StartInteractiveSession() error

StartInteractiveSession starts interactive shell session with the remote.

Jump to

Keyboard shortcuts

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