ssh

package
v0.0.0-...-1b8592a Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort = 22
)

Variables

This section is empty.

Functions

func DeleteKeyPairFiles

func DeleteKeyPairFiles(files *KeyPairFiles) error

DeleteKeyPairFiles deletes the keypair files.

func GenerateSSHKey

func GenerateSSHKey(basePath string, keyName string) (*KeyPair, *KeyPairFiles, error)

GenerateSSHKey generates SSH keypair based on a base path.

func NewClient

func NewClient(host, port, user string, k *KeyPairFiles) (*ssh.Client, *ssh.Session, error)

NewClient creates a new SSH client and session.

Types

type KeyPair

type KeyPair struct {
	PrivateKey []byte
	PublicKey  []byte
}

KeyPair represents a private & public keypair.

func NewKeyPair

func NewKeyPair() (*KeyPair, error)

NewKeyPair generates a new SSH keypair This will return a private & public key encoded as DER.

func (*KeyPair) WriteToFile

func (kp *KeyPair) WriteToFile(privateKeyPath string, publicKeyPath string) error

WriteToFile writes keypair to files.

type KeyPairFiles

type KeyPairFiles struct {
	PrivateKeyPath string `json:"publicKeyPath"`
	PublicKeyPath  string `json:"privateKeyPath"`
}

KeyPairFiles holds the paths to a private & public key files.

Jump to

Keyboard shortcuts

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