network

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultInterface = "eth0"

DefaultInterface is the default public interface for the host that will be used for dhcp requests TODO replace this with kernel arg

Variables

This section is empty.

Functions

func InitNetwork

func InitNetwork() (err error)

InitNetwork handles the initial network setup. This includes doing ifup for lo and eth0 and the initial ip addressing via dhcp for eth0

func SetupNetwork

func SetupNetwork(data *userdata.UserData) (err error)

SetupNetwork configures the network interfaces based on userdata. If the userdata does not contain any network configuration, the default network setup done in InitNetwork is maintained and dhcpd is kicked off for eth0. nolint: gocyclo

func StaticAddress

func StaticAddress(netconf userdata.Device) (err error)

StaticAddress handles the setting of a static IP address on a network interface

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is a wrapper for 'networkd'.

It's not a standalone service, but it runs as a goroutine in init for now.

func NewService

func NewService() *Service

NewService create backwards compatible entry logging to stderr

func (*Service) DHCPd

func (service *Service) DHCPd(ctx context.Context, ifname string)

DHCPd runs the dhclient process with a certain frequency to maintain a fresh dhcp lease

func (*Service) Dhclient

func (service *Service) Dhclient(ctx context.Context, ifname string) (int, error)

Dhclient handles the enture DHCP client interaction from a request to setting the received address on the interface

func (*Service) Main

func (svc *Service) Main(ctx context.Context, data *userdata.UserData, logWriter io.Writer) error

Main is an entrypoint into the service

Jump to

Keyboard shortcuts

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