net

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package net generates config files for network management daemons.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DHCPClientConf

type DHCPClientConf struct {
	ControlGroup string // Group to set ownership of control socket.
	Sections     []DHCPClientProfile
}

DHCPClientConf encapsulates configuration of the dhcp client.

func (*DHCPClientConf) String

func (c *DHCPClientConf) String() string

String returns a representation ready to use in a config file.

type DHCPClientProfile

type DHCPClientProfile struct {
	ProfileName   string
	InterfaceName string
	Mode          DHCPMode

	DHCP struct {
		LeaseSeconds int

		ClientID    bool
		Persistent  bool
		RapidCommit bool
		SetupDNS    bool
		RequestNTP  bool

		PresentHostname bool
		Hostname        string
	}

	Static struct {
		Network     net.IPNet
		Broadcast   net.IP
		IPv6Address net.IP
		Routers     []net.IP
		DNS         []string
	}
}

DHCPClientProfile describes a unit of dhcpcd configuration. Only one of InterfaceName or ProfileName should be set.

func (*DHCPClientProfile) String

func (p *DHCPClientProfile) String() string

String returns a representation ready to use in a config file.

type DHCPMode

type DHCPMode uint8

DHCPMode controls how an interface behaves.

const (
	ModeDHCP DHCPMode = iota
	ModeStatic
)

Valid DHCPMode values.

type WPASupplicantConfig

type WPASupplicantConfig struct {
	CtrlInterface      string // Path to specify control interface.
	CtrlInterfaceGroup string // Group allowed access to the control interface.
	AllowUpdateConfig  bool   // Generates update_config=1 if true.
	CountryCode        string // Such as US.
	DeviceName         string

	Networks []WPASupplicantNetwork
}

WPASupplicantConfig describes the configuration of the WPA supplicant daemon.

func (*WPASupplicantConfig) String

func (c *WPASupplicantConfig) String() string

String generates the config file.

type WPASupplicantMode

type WPASupplicantMode uint8

WPASupplicantMode represents the type of network configuration.

const (
	ModeClient WPASupplicantMode = iota
	ModeAdhoc
	ModeAP
)

Valid WPASupplicantMode modes.

type WPASupplicantNetwork

type WPASupplicantNetwork struct {
	Mode     WPASupplicantMode
	Disabled bool
	SSID     string
	PSK      string
}

WPASupplicantNetwork represents configuration for a specific network.

func (*WPASupplicantNetwork) String

func (c *WPASupplicantNetwork) String() string

String generates the config file section for the network.

Jump to

Keyboard shortcuts

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