sshtunnel

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPrivateKeyAuthMethod

func GetPrivateKeyAuthMethod(keyBytes []byte, passphrase *string) (ssh.AuthMethod, error)

func ParseSshKey

func ParseSshKey(keyString string) (ssh.PublicKey, error)

Types

type Endpoint

type Endpoint struct {
	Host string
	Port int
	User string
}

func NewEndpoint

func NewEndpoint(host string, port int) *Endpoint

func NewEndpointWithUser

func NewEndpointWithUser(host string, port int, user string) *Endpoint

NewEndpoint creates an Endpoint from a string that contains a user, host and port. Both User and Port are optional (depending on context). The host can be a domain name, IPv4 address or IPv6 address. If it's an IPv6, it must be enclosed in square brackets

func (*Endpoint) String

func (endpoint *Endpoint) String() string

Returns the stringified endpoint sans user

type Sshtunnel

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

func New

func New(
	tunnel *Endpoint,
	auth ssh.AuthMethod,
	destination *Endpoint,
	local *Endpoint,
	maxConnectionAttempts uint,
	serverPublicKey ssh.PublicKey,
) *Sshtunnel

func (*Sshtunnel) Close

func (t *Sshtunnel) Close()

func (*Sshtunnel) GetLocalHostPort

func (t *Sshtunnel) GetLocalHostPort() (host string, port int)

After a tunnel has started, this will return the auto-generated port (if 0 was passed in)

func (*Sshtunnel) Start

func (t *Sshtunnel) Start(logger *slog.Logger) (chan any, error)

Jump to

Keyboard shortcuts

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