networks

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

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"
)
View Source
const (
	SocketVMNet = "socket_vmnet"
)

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

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"`
	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) 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