Documentation ¶
Index ¶
- Constants
- func ConfigFile() (string, error)
- func IsUsernet(name string) bool
- func Sock(name string) (string, error)
- func Sudoers() (string, error)
- type Config
- func (c *Config) Check(name string) error
- func (c *Config) DaemonPath(daemon string) (string, error)
- func (c *Config) IsDaemonInstalled(daemon string) (bool, error)
- func (c *Config) LogFile(name, daemon, stream string) string
- func (c *Config) MkdirCmd() string
- func (c *Config) PIDFile(name, daemon string) string
- func (c *Config) Sock(name string) string
- func (c *Config) StartCmd(name, daemon string) string
- func (c *Config) StopCmd(name, daemon string) string
- func (c *Config) User(daemon string) (osutil.User, error)
- func (c *Config) Usernet(name string) (bool, error)
- func (c *Config) Validate() error
- func (c *Config) VerifySudoAccess(sudoersFile string) error
- type Network
- type Paths
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" ModeBridged = "bridged" )
View Source
const (
SocketVMNet = "socket_vmnet"
)
Variables ¶
This section is empty.
Functions ¶
func ConfigFile ¶
func IsUsernet ¶ added in v0.23.0
IsUsernet returns true if the given network name is a usernet network. It return false if the cache cannot be loaded or the network is not defined.
Types ¶
type Config ¶
type Config struct { Paths Paths `yaml:"paths"` Group string `yaml:"group,omitempty"` // default: "everyone" Networks map[string]Network `yaml:"networks"` }
func DefaultConfig ¶
func LoadConfig ¶ added in v1.0.0
LoadConfig returns the network cfg from the _config/networks.yaml file.
func (*Config) DaemonPath ¶ added in v1.0.0
DaemonPath returns the daemon path.
func (*Config) IsDaemonInstalled ¶ added in v1.0.0
IsDaemonInstalled checks whether the daemon is installed.
func (*Config) Usernet ¶ added in v1.0.0
Usernet returns true if the mode of given network is ModeUserV2.
func (*Config) VerifySudoAccess ¶ added in v1.0.0
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 }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.