sshutil

package
v0.0.0-...-99b7af3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSSHKeyPair

func CreateSSHKeyPair(folder, name string, numBits int) (string, string, error)

func GenerateSSHKeyPair

func GenerateSSHKeyPair(bits int) (string, string, error)

func GetSSHPublicKeyFingerprintMD5

func GetSSHPublicKeyFingerprintMD5(publicKey string) (string, error)

func LoadOrCreateSSHKeyPair

func LoadOrCreateSSHKeyPair(folder, name string) (string, string, error)

func LoadSSHKeyPair

func LoadSSHKeyPair(folder, name string) (string, string, error)

Types

type SSHConnIdentifier

type SSHConnIdentifier struct {
	Host string
	Port int
	User string
}

SSHConnIdentifier uniquely identifies an SSH connection by its host, port, and user.

func NewSSHConnIdentifier

func NewSSHConnIdentifier(host string, port int, user string) SSHConnIdentifier

NewSSHConnIdentifier creates and returns a new SSHConnIdentifier.

func (SSHConnIdentifier) String

func (id SSHConnIdentifier) String() string

String returns a string representation of SSHConnIdentifier in the format user:port@host.

type SSHConnection

type SSHConnection struct {
	Client *ssh.Client
	Host   string
}

SSHConnection represents an SSH connection with a client and its host.

type SSHConnectionPool

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

SSHConnectionPool manages a pool of SSH connections using a concurrent-safe map.

func GetSSHConnectionPool

func GetSSHConnectionPool() *SSHConnectionPool

GetSSHConnectionPool initializes (if not already) and returns the singleton instance of SSHConnectionPool.

func (*SSHConnectionPool) GetConnection

func (pool *SSHConnectionPool) GetConnection(id SSHConnIdentifier, config *ssh.ClientConfig) (*SSHConnection, error)

Jump to

Keyboard shortcuts

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