libve

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigPath = "/etc/rootve"

Default configuration file path

Variables

This section is empty.

Functions

func ReadConfig

func ReadConfig(path string) (map[string]VirtConfig, error)

Read configuration map from toml file

func WriteConfig

func WriteConfig(path string, mvc map[string]VirtConfig) error

Write configuration map to toml file

Types

type VirtConfig

type VirtConfig struct {
	// Environmental
	Root        string
	Autoboot    bool
	Directory   string
	Uid         int
	Gid         int
	Environment []string

	// Client process
	CommandPath string
	CommandArgs []string

	// Networking
	Networking bool
	Bridge     string
	Interface  string
	AddressV4  string
	NetmaskV4  string
}

Configuration entry structure

func MakeVirtConfig

func MakeVirtConfig() VirtConfig

Allocate and initialize VE configuration with default values

type VirtEnv

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

The "Virtual Environment"

func NewEnvironment

func NewEnvironment(vc VirtConfig) *VirtEnv

Allocate virtual environment

func (*VirtEnv) Chroot

func (ve *VirtEnv) Chroot() error

Change root and directory

func (*VirtEnv) Devinit

func (ve *VirtEnv) Devinit()

Attempt to initialize devices

func (*VirtEnv) Execute

func (ve *VirtEnv) Execute() error

Execute the process inside

func (*VirtEnv) Mount

func (ve *VirtEnv) Mount() error

Attempt to mount all filesystems

func (*VirtEnv) Netinit added in v0.2.0

func (ve *VirtEnv) Netinit() error

Initialize networking

func (*VirtEnv) SetCreds

func (ve *VirtEnv) SetCreds() error

Set the user and group id

func (*VirtEnv) SetShell added in v1.0.0

func (ve *VirtEnv) SetShell()

Set the process to be a shell

func (*VirtEnv) Stdinit added in v0.2.0

func (ve *VirtEnv) Stdinit(shellMode bool) error

Configure the standard devices

func (*VirtEnv) Umount added in v0.3.0

func (ve *VirtEnv) Umount() error

Attempt to unmount all filesystems

Jump to

Keyboard shortcuts

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