ssh

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AvailablePathSelectors = []string{"default", "ping", "round-robin", "random"}
)

Functions

This section is empty.

Types

type AuthenticationHandler

type AuthenticationHandler func() (secret string, err error)

AuthenticationHandler is a function that represents an authentication method.

type Client

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

Client is a struct representing an SSH client. It consists of a connection to the server, and at most one terminal session (per SSH specification, a connection may not serve multiple sessions)

func Create

func Create(username string, config *clientconfig.ClientConfig, passAuthHandler AuthenticationHandler,
	verifyNewKeyHandler VerifyHostKeyHandler) (*Client, error)

Create creates a new unconnected Client.

func (*Client) CloseSession

func (client *Client) CloseSession()

CloseSession closes the current session

func (*Client) Connect

func (client *Client) Connect(ctx context.Context, addr string, policy pan.Policy, selector string) error

Connect connects the Client to the given address.

func (*Client) ConnectPipes

func (client *Client) ConnectPipes(reader io.Reader, writer io.Writer) error

ConnectPipes connects the given reader and writer to the session's in- and output

func (*Client) Dial

func (client *Client) Dial(addr string) (io.ReadWriteCloser, error)

Dial dials the given address over a tunnel to the server. If the given address is a SCION address, QUIC is used; else TCP.

func (*Client) RunSession

func (client *Client) RunSession(cmd string) error

RunSession runs a terminal session, waiting for it to end.

func (*Client) Shell

func (client *Client) Shell() error

Shell opens a new Shell session on the server this Client is connected to.

func (*Client) StartSession

func (client *Client) StartSession(cmd string) error

StartSession starts a terminal session, not waiting for it to end.

func (*Client) StartTunnel

func (client *Client) StartTunnel(local netaddr.IPPort, addr string) error

StartTunnel creates a new tunnel to the given address, forwarding all connections on the given port over the server to the given address. If the given address is a SCION address, QUIC is used; else TCP.

func (*Client) WaitSession

func (client *Client) WaitSession() error

WaitSession waits for a terminal session to end.

type VerifyHostKeyHandler

type VerifyHostKeyHandler func(hostname string, remote net.Addr, key string) bool

VerifyHostKeyHandler is a function that verifies host keys, often by user interaction

Directories

Path Synopsis
Package knownhosts implements a parser for the OpenSSH known_hosts host key database.
Package knownhosts implements a parser for the OpenSSH known_hosts host key database.

Jump to

Keyboard shortcuts

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