sshkey

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sshkey manages SSH key generation and provides an SSH client for VM access.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client creates an SSH client connected to the given address.

func (*Client) Close

func (c *Client) Close() error

Close closes the SSH connection.

func (*Client) Run

func (c *Client) Run(cmd string) (string, error)

Run executes a command and returns the combined stdout/stderr output.

type Manager

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

Manager handles SSH key storage and client creation.

func NewManager

func NewManager(keyPath string) *Manager

NewManager creates a Manager with keys stored at the given path. The path should be the private key path (e.g., ~/.fleetbox/id_ed25519).

func (*Manager) Dial

func (m *Manager) Dial(addr, user string, timeout time.Duration) (*Client, error)

Dial connects to the SSH server at the given address using the manager's key.

func (*Manager) DialIP

func (m *Manager) DialIP(ip net.IP, user string, timeout time.Duration) (*Client, error)

DialIP is a convenience function that dials port 22 on the given IP.

func (*Manager) EnsureKey

func (m *Manager) EnsureKey() (string, error)

EnsureKey generates an ed25519 keypair if it doesn't exist. Returns the public key in authorized_keys format.

func (*Manager) Path

func (m *Manager) Path() string

Path returns the private key path.

func (*Manager) PrivateKey

func (m *Manager) PrivateKey() ([]byte, error)

PrivateKey returns the private key bytes.

func (*Manager) WaitForSSH

func (m *Manager) WaitForSSH(addr, user string, timeout time.Duration) error

WaitForSSH waits until SSH is available at the given address.

Jump to

Keyboard shortcuts

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