sshtunnel

package
v21.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMethodFromPrivateKey

func AuthMethodFromPrivateKey(buffer []byte, passphrase []byte) (_ ssh.AuthMethod, err error)

func AuthMethodFromPrivateKeyFile

func AuthMethodFromPrivateKeyFile(file string, passphrase []byte) (_ ssh.AuthMethod, err error)

func DialSSHWithTimeout

func DialSSHWithTimeout(network, addr string, config *ssh.ClientConfig, timeout time.Duration) (
	_ *ssh.Client, err error,
)

func GenerateRSAKeyPair

func GenerateRSAKeyPair(keylen int) (privKey string, pubKey string, err error)

GenerateRSAKeyPair creates a key pair

func OnPanic

func OnPanic(err *error) func()

func RunCommandInSSHSessionWithTimeout

func RunCommandInSSHSessionWithTimeout(se *ssh.Session, cmd string, timeout time.Duration) (err error)

Types

type Endpoint

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

func NewEndpoint

func NewEndpoint(s string, options ...EndpointOption) (_ *Endpoint, err error)

func (Endpoint) Address

func (endpoint Endpoint) Address() string

func (Endpoint) Authentication

func (endpoint Endpoint) Authentication() []ssh.AuthMethod

func (Endpoint) Dump

func (endpoint Endpoint) Dump() string

func (Endpoint) Host

func (endpoint Endpoint) Host() string

func (Endpoint) Port

func (endpoint Endpoint) Port() int

func (Endpoint) String

func (endpoint Endpoint) String() string

func (Endpoint) User

func (endpoint Endpoint) User() string

func (Endpoint) Validate

func (endpoint Endpoint) Validate() error

type EndpointOption

type EndpointOption func(tunnel *Endpoint) error

func EndpointOptionAuth

func EndpointOptionAuth(auth ssh.AuthMethod) EndpointOption

func EndpointOptionKeyFromFile

func EndpointOptionKeyFromFile(filename, passphrase string) EndpointOption

func EndpointOptionKeyFromString

func EndpointOptionKeyFromString(key string, passphrase string) EndpointOption

func EndpointOptionPassword

func EndpointOptionPassword(pass string) EndpointOption

type Entrypoint

type Entrypoint = Endpoint

type Option

type Option func(tunnel *SSHTunnel) error

func TunnelOptionWithDefaultKeepAlive

func TunnelOptionWithDefaultKeepAlive() Option

func TunnelOptionWithDialTimeout

func TunnelOptionWithDialTimeout(timeout time.Duration) Option

func TunnelOptionWithKeepAlive

func TunnelOptionWithKeepAlive(keepAlive time.Duration) Option

func TunnelOptionWithLogger

func TunnelOptionWithLogger(myLogger logger) Option

type SSHJump

type SSHJump = Endpoint

type SSHTunnel

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

func NewSSHTunnel

func NewSSHTunnel(tunnel string, auth ssh.AuthMethod, destination string, options ...Option) (_ *SSHTunnel, err error)

NewSSHTunnel creates a ssh tunnel through localhost:0

func NewSSHTunnelFromCfg

func NewSSHTunnelFromCfg(gw SSHJump, target Endpoint, local Entrypoint, options ...Option) (_ *SSHTunnel, err error)

func NewSSHTunnelWithLocalBinding

func NewSSHTunnelWithLocalBinding(
	tunnel string, auth ssh.AuthMethod, destination string, source string, options ...Option,
) (_ *SSHTunnel, err error)

NewSSHTunnelWithLocalBinding creates a ssh tunnel

func (*SSHTunnel) Close

func (tunnel *SSHTunnel) Close()

func (SSHTunnel) GetLocalEndpoint

func (tunnel SSHTunnel) GetLocalEndpoint() Endpoint

func (SSHTunnel) GetRemoteEndpoint

func (tunnel SSHTunnel) GetRemoteEndpoint() Endpoint

func (SSHTunnel) GetServerEndpoint

func (tunnel SSHTunnel) GetServerEndpoint() Endpoint

func (*SSHTunnel) Ready

func (tunnel *SSHTunnel) Ready() <-chan bool

func (*SSHTunnel) SetCommand

func (tunnel *SSHTunnel) SetCommand(cmd string)

func (*SSHTunnel) Start

func (tunnel *SSHTunnel) Start() (err error)

Jump to

Keyboard shortcuts

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