Documentation ¶
Index ¶
- Constants
- func Apply(root string, ifaces []*Interface) error
- func CheckURL(url string) error
- func CopyNetworkInterfaces(rootDir string) error
- func DownloadInstallerMessage(header string, installConf string) string
- func EnablePacDiscovery(rootDir string) error
- func FetchRemoteConfigFile(url string) (string, error)
- func IsNetworkManagerActive() bool
- func IsValidDomainName(domain string) string
- func IsValidIP(str string) string
- func IsValidURI(uri string, allowInsecureHTTP bool) bool
- func Restart() error
- func VerifyConnectivity() error
- type Addr
- type Interface
- func (i *Interface) AddAddr(IP string, NetMask string, Version int)
- func (i *Interface) ApplyNetworkD(root string) error
- func (i *Interface) ApplyNetworkManager(root string) error
- func (i *Interface) GetDNSInfo() (string, string, error)
- func (i *Interface) GetGateway() (string, error)
- func (i *Interface) HasIPv4Addr() bool
- func (i *Interface) IsUserDefined() bool
- func (i *Interface) MarshalYAML() (interface{}, error)
- func (i *Interface) UnmarshalYAML(unmarshal func(interface{}) error) error
- type LangString
- type Messenger
Constants ¶
const ( // RequiredBundle the bundle needed to use NetworkManager RequiredBundle = "NetworkManager" // IPv4 identifies the addr version as ipv4 IPv4 = iota // IPv6 identifies the addr version as ipv6 IPv6 // PreInstallConf is the name of the pre-installation message file PreInstallConf = "pre-install-msg.yaml" // PostInstallConf is the name of the pre-installation message file PostInstallConf = "post-install-msg.yaml" // PreGuiInstallConf is the name of the pre-installation message file PreGuiInstallConf = "pre-gui-install-msg.yaml" // PostGuiInstallConf is the name of the pre-installation message file PostGuiInstallConf = "post-gui-install-msg.yaml" )
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply apply the configurations of a set of interfaces to the running system Determines the network manage type to generate the correct files
func CopyNetworkInterfaces ¶
CopyNetworkInterfaces transfer the user defined network interface files to the target installation media
func DownloadInstallerMessage ¶
DownloadInstallerMessage pulls down a message from a URL Intended for getting a message to display before or after the installation process
func EnablePacDiscovery ¶
EnablePacDiscovery turns on the pacdiscovery service Normally this service is enabled by a DHCP lease path, but it must be manually enabled if we set a static IP
func FetchRemoteConfigFile ¶
FetchRemoteConfigFile given an config url fetches it from the network. This function currently supports only http/https protocol. After success return the local file path.
func IsNetworkManagerActive ¶
func IsNetworkManagerActive() bool
IsNetworkManagerActive is used to check if we are using systemd.networkd or NetworkManager to manage the wired connections. Clear Linux OS change from system.networkd to NetworkManager in April 2019 build ?????
func IsValidDomainName ¶
IsValidDomainName returns error message or nil if is valid
func IsValidURI ¶
IsValidURI checks for valid URIs that use the HTTPS or FILE protocol
func VerifyConnectivity ¶
func VerifyConnectivity() error
VerifyConnectivity tests if the network configuration is working
Types ¶
type Addr ¶
Addr wraps the net' package Addr struct
func (*Addr) VersionString ¶
VersionString returns a string representation for a given addr version (ipv4/ipv6)
type Interface ¶
type Interface struct { Name string Addrs []*Addr DHCP bool Gateway string `json:"gateway,omitempty"` DNSServer string DNSDomain string UserDefined bool Metric uint32 `json:"metric,omitempty"` }
Interface is a network interface representation and wraps the net' package Interface struct
func Interfaces ¶
Interfaces lists all available network interfaces
func (*Interface) AddAddr ¶
AddAddr adds a new interface set with the provided arguments to a given Interface
func (*Interface) ApplyNetworkD ¶
ApplyNetworkD does apply the interface configuration to the running system using systemd.networkd
func (*Interface) ApplyNetworkManager ¶
ApplyNetworkManager does apply the interface configuration to the running system using Network Manager
func (*Interface) GetDNSInfo ¶
GetDNSInfo returns the DNS Server and Domain
func (*Interface) GetGateway ¶
GetGateway returns the best gateway for the interface
func (*Interface) HasIPv4Addr ¶
HasIPv4Addr will lookup an addr with Version set to ipv4
func (*Interface) IsUserDefined ¶
IsUserDefined returns true if the configuration was interactively defined by the user
func (*Interface) MarshalYAML ¶
MarshalYAML marshals Interface into YAML format
func (*Interface) UnmarshalYAML ¶
UnmarshalYAML unmarshals Interface from YAML format
type LangString ¶
type LangString struct { Default string `yaml:"default,omitempty"` EnUs string `yaml:"en_US,omitempty"` }
LangString hold strings for each translated language and one for default if the current language is unavailable
type Messenger ¶
type Messenger struct {
Messages []*LangString `yaml:"install-msg,omitempty"`
}
Messenger is an array of language string used to create an end user message for display