Documentation
¶
Overview ¶
Package sshkey manages SSH key generation and provides an SSH client for VM access.
Index ¶
- type Client
- type Manager
- func (m *Manager) Dial(addr, user string, timeout time.Duration) (*Client, error)
- func (m *Manager) DialIP(ip net.IP, user string, timeout time.Duration) (*Client, error)
- func (m *Manager) EnsureKey() (string, error)
- func (m *Manager) Path() string
- func (m *Manager) PrivateKey() ([]byte, error)
- func (m *Manager) WaitForSSH(addr, user string, timeout time.Duration) error
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) CopyFrom ¶ added in v0.5.0
CopyFrom copies guestPath (a file or a directory tree) out of the guest, placing it at hostPath exactly: CopyFrom("/var/log/app", "./app") makes the host file or directory "./app". Missing parent directories on the host are created. File modes are restored from the tar header; ownership is not preserved. guestPath must be absolute. It streams over the existing SSH connection and rejects any archive entry that would escape the destination (absolute paths, "..", escaping symlinks).
func (*Client) CopyTo ¶ added in v0.5.0
CopyTo copies hostPath (a file or a directory tree) into the guest, placing it at guestPath exactly: CopyTo("./app", "/srv/app") makes the file or directory "/srv/app". Missing parent directories on the guest are created. File modes ride the tar header and are restored (an executable stays executable); ownership is not preserved — the copied tree belongs to the connecting user. guestPath must be absolute. It streams over the existing SSH connection and adds no guest-side requirement beyond `tar`, present on every stock cloud image.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles SSH key storage and client creation.
func NewManager ¶
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 ¶
Dial connects to the SSH server at the given address using the manager's key.
func (*Manager) EnsureKey ¶
EnsureKey generates an ed25519 keypair if it doesn't exist. Returns the public key in authorized_keys format.
func (*Manager) PrivateKey ¶
PrivateKey returns the private key bytes.