hypervisor

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hypervisor finds local VMs and their current SSH address through each hypervisor's own CLI, so a devbox's Host block need not carry an IP that changes on every boot.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("not supported by this hypervisor's CLI")

ErrNotSupported means the hypervisor's CLI cannot do this without more than sshmgr has (VMware runs guest commands only with guest credentials).

View Source
var ErrOwnKeys = errors.New("this hypervisor manages its own SSH access and keys")

ErrOwnKeys means the hypervisor runs its own SSH access and keys (OrbStack, Podman): sshmgr lists the machine and can point a Docker context at it, but does not take its keys over.

Functions

func Available

func Available(d Driver) bool

Available reports whether d's CLI was found.

Types

type Driver

type Driver interface {
	Name() string
	// CLI is the command the driver runs, "" when it cannot be found.
	CLI() string
	List() ([]VM, error)
	Address(vm string) (Endpoint, error)
	Start(vm string) error
	// Exec runs argv inside the VM (for installing a key without SSH); ErrNotSupported or ErrOwnKeys
	// when the CLI cannot.
	Exec(vm string, argv ...string) ([]byte, error)
}

Driver is one hypervisor.

func All

func All() []Driver

All returns every driver, in the documented order.

func For

func For(name string) (Driver, error)

For returns the driver for a manifest hypervisor name.

type Endpoint

type Endpoint struct {
	Host string
	Port int
}

Endpoint is where a VM's SSH server answers right now.

func (Endpoint) HostPort

func (e Endpoint) HostPort() string

HostPort renders an endpoint for ssh -W style use.

type VM

type VM struct {
	Name    string
	State   string
	Running bool
}

VM is one machine a hypervisor reports.

Jump to

Keyboard shortcuts

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