Versions in this module Expand all Collapse all v0 v0.2.0 Dec 2, 2023 Changes in this version + var ErrAddressNotSetStatic = errors.New("address not set with static config") + var ErrAddressSetWhenDHCP = errors.New("address set when DHCP enabled") + var ErrAdressNotLoopback = errors.New("address must be loopback when config is loopback") + var ErrInterfaceHasErrors = errors.New("interface has errors") + var ErrInvalidAddress = errors.New("invalid address") + var ErrInvalidAddressVersion = errors.New("invalid address version") + var ErrInvalidBroadcast = errors.New("invalid broadcast") + var ErrInvalidGateway = errors.New("invalid gateway") + var ErrInvalidIfaceData = errors.New("invalid interface data provided") + var ErrInvalidMask = errors.New("invalid mask") + var ErrMaskNotSetStatic = errors.New("mask not set with static config") + var ErrMultipleInterfaces = errors.New("multiple interfaces in data provided") + var ErrUnallocatedInterface = errors.New("unallocated interface") + type AddressConfig uint8 + const AddressConfigDHCP + const AddressConfigLoopback + const AddressConfigManual + const AddressConfigStatic + const AddressConfigUnset + func (ac AddressConfig) String() string + type AddressVersion uint8 + const AddressVersion4 + const AddressVersion6 + const AddressVersionNil + func (at AddressVersion) String() string + type Hooks struct + PostDown []string + PostUp []string + PreDown []string + PreUp []string + type Interfaces map[string]*NetworkInterface + func (i Interfaces) Read(p []byte) (int, error) + func (i Interfaces) String() string + func (i Interfaces) UnmarshalJSON(data []byte) error + type MultiParser struct + Errs []error + Interfaces map[string]*NetworkInterface + func NewMultiParser() *MultiParser + func (p *MultiParser) Parse() (Interfaces, error) + func (p *MultiParser) Write(data []byte) (int, error) + type NetworkInterface struct + Address net.IP + Auto bool + Broadcast net.IP + Config AddressConfig + DNSSearch []string + DNSServers []net.IP + Gateway net.IP + Hooks Hooks + Hotplug bool + MACAddress net.HardwareAddr + Name string + Netmask net.IPMask + Version AddressVersion + func NewNetworkInterface(name string) *NetworkInterface + func (iface *NetworkInterface) Read(p []byte) (int, error) + func (iface *NetworkInterface) String() string + func (iface *NetworkInterface) Validate() error + func (iface *NetworkInterface) WithAddress(address string) *NetworkInterface + func (iface *NetworkInterface) WithAddressConfig(config AddressConfig) *NetworkInterface + func (iface *NetworkInterface) WithAddressVersion(version AddressVersion) *NetworkInterface + func (iface *NetworkInterface) WithBroadcast(broadcast string) *NetworkInterface + func (iface *NetworkInterface) WithConfigMethod(config AddressConfig) *NetworkInterface + func (iface *NetworkInterface) WithDHCP() *NetworkInterface + func (iface *NetworkInterface) WithDNS(dnsServers []string) *NetworkInterface + func (iface *NetworkInterface) WithDNSSearch(dnsSearch []string) *NetworkInterface + func (iface *NetworkInterface) WithGateway(gateway string) *NetworkInterface + func (iface *NetworkInterface) WithLoopback() *NetworkInterface + func (iface *NetworkInterface) WithMACAddress(macAddress string) *NetworkInterface + func (iface *NetworkInterface) WithManual() *NetworkInterface + func (iface *NetworkInterface) WithNetmask(mask, bits int) *NetworkInterface + func (iface *NetworkInterface) WithStatic() *NetworkInterface + func (iface *NetworkInterface) WithVersion(version AddressVersion) *NetworkInterface + func (iface *NetworkInterface) Write(p []byte) (int, error) v0.1.0 Dec 2, 2023