ssh_client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSSHTunnel

func InitSSHTunnel()

Types

type Client

type Client struct {
	Client *ssh.Client
}

func Dial

func Dial(network, addr string, config *ssh.ClientConfig) (*Client, error)

Dial starts a client connection to the given SSH server. This is wrap the ssh.Dial

func DialWithKey

func DialWithKey(addr, user, keyfile string) (*Client, error)

DialWithKey starts a client connection to the given SSH server with key authmethod.

func DialWithKeyWithPassphrase

func DialWithKeyWithPassphrase(addr, user, keyfile string, passphrase string) (*Client, error)

DialWithKeyWithPassphrase same as DialWithKey but with a passphrase to decrypt the private key

func DialWithPasswd

func DialWithPasswd(addr, user, passwd string) (*Client, error)

DialWithPasswd starts a client connection to the given SSH server with passwd authmethod.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Cmd

func (c *Client) Cmd(cmd string) *remoteScript

Cmd create a command on client

func (*Client) Script

func (c *Client) Script(script string) *remoteScript

Script

func (*Client) ScriptFile

func (c *Client) ScriptFile(fname string) *remoteScript

ScriptFile

func (*Client) Shell

func (c *Client) Shell() *remoteShell

Shell create a noninteractive shell on client.

func (*Client) Terminal

func (c *Client) Terminal(config *TerminalConfig) *remoteShell

Terminal create a interactive shell on client.

type TerminalConfig

type TerminalConfig struct {
	Term   string
	Hight  int
	Weight int
	Modes  ssh.TerminalModes
}

type ViaSSHDialer

type ViaSSHDialer struct {
	Client *ssh.Client
	// contains filtered or unexported fields
}

func (*ViaSSHDialer) Dial

func (self *ViaSSHDialer) Dial(context context.Context, addr string) (net.Conn, error)

Jump to

Keyboard shortcuts

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