netboot

package
v0.0.0-...-99f0e32 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureInterface

func ConfigureInterface(ifname string, netconf *NetConf) (err error)

ConfigureInterface configures a network interface with the configuration held by a NetConf structure

func IfUp

func IfUp(ifname string, timeout time.Duration) (_ *net.Interface, err error)

IfUp brings up an interface by name, and waits for it to come up until a timeout expires

func RequestNetbootv4

func RequestNetbootv4(ifname string, timeout time.Duration, retries int, modifiers ...dhcpv4.Modifier) ([]*dhcpv4.DHCPv4, error)

RequestNetbootv4 sends a netboot request via DHCPv4 and returns the exchanged packets. Additional modifiers can be passed to manipulate both the discover and offer packets.

func RequestNetbootv6

func RequestNetbootv6(ifname string, timeout time.Duration, retries int, modifiers ...dhcpv6.Modifier) ([]dhcpv6.DHCPv6, error)

RequestNetbootv6 sends a netboot request via DHCPv6 and returns the exchanged packets. Additional modifiers can be passed to manipulate both solicit and advertise packets.

Types

type AddrConf

type AddrConf struct {
	IPNet             net.IPNet
	PreferredLifetime time.Duration
	ValidLifetime     time.Duration
}

AddrConf holds a single IP address configuration for a NIC

type BootConf

type BootConf struct {
	// NetConf is the network configuration of the client
	NetConf

	// BootfileURL is "where is the image (kernel)".
	// See RFC5970 section 3.1 for IPv6 and RFC2132 section 9.5 ("Bootfile name") for IPv4
	BootfileURL string

	// BootfileParam is "what arguments should we pass (cmdline)".
	// See RFC5970 section 3.2 for IPv6.
	BootfileParam []string
}

BootConf is a structure describes everything a host needs to know to boot over network

func ConversationToNetconf

func ConversationToNetconf(conversation []dhcpv6.DHCPv6) (*BootConf, error)

ConversationToNetconf extracts network configuration and boot file URL from a DHCPv6 4-way conversation and returns them, or an error if any.

func ConversationToNetconfv4

func ConversationToNetconfv4(conversation []*dhcpv4.DHCPv4) (*BootConf, error)

ConversationToNetconfv4 extracts network configuration and boot file URL from a DHCPv4 4-way conversation and returns them, or an error if any.

type NetConf

type NetConf struct {
	Addresses     []AddrConf
	DNSServers    []net.IP
	DNSSearchList []string
	Routers       []net.IP
	NTPServers    []net.IP
}

NetConf holds multiple IP configuration for a NIC, and DNS configuration

func GetNetConfFromPacketv4

func GetNetConfFromPacketv4(d *dhcpv4.DHCPv4) (*NetConf, error)

GetNetConfFromPacketv4 extracts network configuration information from a DHCPv4 Reply packet and returns a populated NetConf structure

func GetNetConfFromPacketv6

func GetNetConfFromPacketv6(d *dhcpv6.Message) (*NetConf, error)

GetNetConfFromPacketv6 extracts network configuration information from a DHCPv6 Reply packet and returns a populated NetConf structure

Jump to

Keyboard shortcuts

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