networks

package
v0.18.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	VDESwitch   = "vde_switch" // Deprecated
	VDEVMNet    = "vde_vmnet"  // Deprecated
	SocketVMNet = "socket_vmnet"
)
View Source
const (
	SlirpNICName = "eth0"
	// CIDR is intentionally hardcoded to 192.168.5.0/24, as each of QEMU has its own independent slirp network.
	SlirpNetwork   = "192.168.5.0/24"
	SlirpGateway   = "192.168.5.2"
	SlirpIPAddress = "192.168.5.15"
)
View Source
const (
	ModeUserV2  = "user-v2"
	ModeHost    = "host"
	ModeShared  = "shared"
	ModeBridged = "bridged"
)

Variables

This section is empty.

Functions

func ConfigFile

func ConfigFile() (string, error)

func Sock added in v0.12.0

func Sock(name string) (string, error)

Sock returns a socket_vmnet socket.

func Sudoers

func Sudoers() (string, error)

func Usernet added in v0.16.0

func Usernet(name string) (bool, error)

Usernet Returns true if the given network name is usernet network

func VDESock

func VDESock(name string) (string, error)

VDESock returns a vde socket.

Deprecated. Use Sock.

Types

type Network

type Network struct {
	Mode      string `yaml:"mode"`                // "host", "shared", or "bridged"
	Interface string `yaml:"interface,omitempty"` // only used by "bridged" networks
	Gateway   net.IP `yaml:"gateway,omitempty"`   // only used by "host" and "shared" networks
	DHCPEnd   net.IP `yaml:"dhcpEnd,omitempty"`   // default: same as Gateway, last byte is 254
	NetMask   net.IP `yaml:"netmask,omitempty"`   // default: 255.255.255.0
}

type Paths

type Paths struct {
	SocketVMNet string `yaml:"socketVMNet"`
	VDESwitch   string `yaml:"vdeSwitch"` // Deprecated
	VDEVMNet    string `yaml:"vdeVMNet"`  // Deprecated
	VarRun      string `yaml:"varRun"`
	Sudoers     string `yaml:"sudoers,omitempty"`
}

type YAML added in v0.13.0

type YAML struct {
	Paths    Paths              `yaml:"paths"`
	Group    string             `yaml:"group,omitempty"` // default: "everyone"
	Networks map[string]Network `yaml:"networks"`
}

func Config

func Config() (YAML, error)

Config returns the network config from the _config/networks.yaml file.

func DefaultConfig

func DefaultConfig() (YAML, error)

func (*YAML) Check added in v0.13.0

func (config *YAML) Check(name string) error

func (*YAML) DaemonPath added in v0.13.0

func (config *YAML) DaemonPath(daemon string) (string, error)

DaemonPath returns the daemon path.

func (*YAML) IsDaemonInstalled added in v0.13.0

func (config *YAML) IsDaemonInstalled(daemon string) (bool, error)

IsDaemonInstalled checks whether the daemon is installed.

func (*YAML) LogFile added in v0.13.0

func (config *YAML) LogFile(name, daemon, stream string) string

func (*YAML) MkdirCmd added in v0.13.0

func (config *YAML) MkdirCmd() string

func (*YAML) PIDFile added in v0.13.0

func (config *YAML) PIDFile(name, daemon string) string

func (*YAML) Sock added in v0.13.0

func (config *YAML) Sock(name string) string

Sock returns a socket_vmnet socket.

func (*YAML) StartCmd added in v0.13.0

func (config *YAML) StartCmd(name, daemon string) string

func (*YAML) StopCmd added in v0.13.0

func (config *YAML) StopCmd(name, daemon string) string

func (*YAML) User added in v0.13.0

func (config *YAML) User(daemon string) (osutil.User, error)

func (*YAML) Usernet added in v0.16.0

func (config *YAML) Usernet(name string) (bool, error)

Usernet Returns true if the mode of given network is ModeUserV2

func (*YAML) VDESock added in v0.13.0

func (config *YAML) VDESock(name string) string

VDESock returns a vde socket.

Deprecated. Use Sock.

func (*YAML) Validate added in v0.13.0

func (config *YAML) Validate() error

func (*YAML) VerifySudoAccess added in v0.13.0

func (config *YAML) VerifySudoAccess(sudoersFile string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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