vm

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSSHUnavailable = errors.New("ssh unavailable")
)

Functions

func ParseSSHKeyScan

func ParseSSHKeyScan(knownHosts []byte) (ssh.HostKeyCallback, error)

Types

type BlockDevicePassthroughConfig

type BlockDevicePassthroughConfig struct {
	Path      string
	BlockSize uint64
}

type Config

type Config struct {
	CdromImagePath string
	BIOSPath       string
	Drives         []DriveConfig

	MemoryAlloc uint32 // In KiB.

	PassthroughConfig        PassthroughConfig
	ExtraPortForwardingRules []PortForwardingRule

	// Networking
	UnrestrictedNetworking bool
	Taps                   []TapConfig

	// Timeouts
	OSUpTimeout  time.Duration
	SSHUpTimeout time.Duration

	// Mostly debug-related options.
	Debug                bool // This will show the display and forward all QEMU warnings/errors to stderr.
	InstallBaseUtilities bool
}

type DriveConfig

type DriveConfig struct {
	Path         string
	SnapshotMode bool
}

type FileManager

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

func NewFileManager

func NewFileManager(logger *slog.Logger, vm *VM) *FileManager

func (*FileManager) InitLVM added in v0.2.0

func (fm *FileManager) InitLVM() error

func (*FileManager) Lsblk

func (fm *FileManager) Lsblk() ([]byte, error)

func (*FileManager) Mount

func (fm *FileManager) Mount(devName string, mo MountOptions) error

func (*FileManager) PreopenLUKSContainer added in v0.2.0

func (fm *FileManager) PreopenLUKSContainer(containerDevPath string) error

func (*FileManager) StartAFP

func (fm *FileManager) StartAFP(pwd string) error

func (*FileManager) StartFTP

func (fm *FileManager) StartFTP(pwd string, passivePortStart uint16, passivePortCount uint16, extIP net.IP) error

func (*FileManager) StartSMB

func (fm *FileManager) StartSMB(pwd string) error

type MountOptions

type MountOptions struct {
	LUKSContainerPreopen string

	FSTypeOverride string
	LUKS           bool
}

type PassthroughConfig

type PassthroughConfig struct {
	USB   []USBDevicePassthroughConfig
	Block []BlockDevicePassthroughConfig
}

type PortForwardingRule

type PortForwardingRule struct {
	HostIP   net.IP
	HostPort uint16
	VMPort   uint16
}

func ParsePortForwardingRuleString

func ParsePortForwardingRuleString(s string) (PortForwardingRule, error)

type TapConfig

type TapConfig struct {
	Name string
}

type USBDevicePassthroughConfig

type USBDevicePassthroughConfig struct {
	VendorID  uint16
	ProductID uint16
}

type VM

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

func NewVM

func NewVM(logger *slog.Logger, cfg Config) (*VM, error)

func (*VM) Cancel

func (vm *VM) Cancel() error

func (*VM) ConfigureInterfaceStaticNet

func (vm *VM) ConfigureInterfaceStaticNet(ctx context.Context, iface string, cidr string) error

func (*VM) DialSCP

func (vm *VM) DialSCP() (*scp.Client, error)

func (*VM) DialSSH

func (vm *VM) DialSSH() (*ssh.Client, error)

func (*VM) Run

func (vm *VM) Run() error

func (*VM) SSHUpNotifyChan

func (vm *VM) SSHUpNotifyChan() chan struct{}

Jump to

Keyboard shortcuts

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