Documentation ¶
Index ¶
- Variables
- func Arch(d *dhcpv4.DHCPv4) iana.Arch
- func IsNetbootClient(pkt *dhcpv4.DHCPv4) error
- type ClientType
- type Info
- func (i Info) AddRPIOpt43(opts dhcpv4.Options) []byte
- func (i Info) Bootfile(customUC UserClass, ipxeScript, ipxeHTTPBinServer *url.URL, ...) string
- func (i Info) ClientTypeFrom() ClientType
- func (i Info) IPXEBinaryFrom() string
- func (i Info) NextServer(ipxeHTTPBinServer *url.URL, ipxeTFTPBinServer netip.AddrPort) net.IP
- func (i Info) UserClassFrom() UserClass
- type UserClass
Constants ¶
This section is empty.
Variables ¶
var ArchToBootFile = map[iana.Arch]string{ iana.INTEL_X86PC: "undionly.kpxe", iana.NEC_PC98: "undionly.kpxe", iana.EFI_ITANIUM: "undionly.kpxe", iana.DEC_ALPHA: "undionly.kpxe", iana.ARC_X86: "undionly.kpxe", iana.INTEL_LEAN_CLIENT: "undionly.kpxe", iana.EFI_IA32: "ipxe.efi", iana.EFI_X86_64: "ipxe.efi", iana.EFI_XSCALE: "ipxe.efi", iana.EFI_BC: "ipxe.efi", iana.EFI_ARM32: "snp.efi", iana.EFI_ARM64: "snp.efi", iana.EFI_X86_HTTP: "ipxe.efi", iana.EFI_X86_64_HTTP: "ipxe.efi", iana.EFI_ARM32_HTTP: "snp.efi", iana.EFI_ARM64_HTTP: "snp.efi", iana.Arch(41): "snp.efi", }
ArchToBootFile maps supported hardware PXE architectures types to iPXE binary files.
var ErrUnknownArch = fmt.Errorf("could not determine client architecture from option 93")
ErrUnknownArch is used when the PXE client request is from an unknown architecture.
Functions ¶
func IsNetbootClient ¶
IsNetbootClient returns nil if the client is a valid netboot client. Otherwise it returns an error.
A valid netboot client will have the following in its DHCP request: 1. is a DHCP discovery/request message type. 2. option 93 is set. 3. option 94 is set. 4. option 97 is correct length. 5. option 60 is set with this format: "PXEClient:Arch:xxxxx:UNDI:yyyzzz" or "HTTPClient:Arch:xxxxx:UNDI:yyyzzz".
See: http://www.pix.net/software/pxeboot/archive/pxespec.pdf
Types ¶
type ClientType ¶
type ClientType string
ClientType is from DHCP option 60. Normally only PXEClient or HTTPClient.
const ( PXEClient ClientType = "PXEClient" HTTPClient ClientType = "HTTPClient" )
type Info ¶
type Info struct { // Pkt is the dhcp packet that was received from the client. Pkt *dhcpv4.DHCPv4 // Arch is the architecture of the client. Use NewInfo to automatically populate this field. Arch iana.Arch // Mac is the mac address of the client. Use NewInfo to automatically populate this field. Mac net.HardwareAddr // UserClass is the user class of the client. Use NewInfo to automatically populate this field. UserClass UserClass // ClientType is the client type of the client. Use NewInfo to automatically populate this field. ClientType ClientType // IsNetbootClient returns nil if the client is a valid netboot client. Otherwise it returns an error. // Use NewInfo to automatically populate this field. IsNetbootClient error // IPXEBinary is the iPXE binary file to boot. Use NewInfo to automatically populate this field. IPXEBinary string }
Info holds details about the dhcp request. Use NewInfo to populate the struct fields from a dhcp packet.
func (Info) AddRPIOpt43 ¶
AddRPIOpt43 adds the Raspberry PI required option43 sub options to an existing opt 43.
func (Info) Bootfile ¶
func (i Info) Bootfile(customUC UserClass, ipxeScript, ipxeHTTPBinServer *url.URL, ipxeTFTPBinServer netip.AddrPort) string
Bootfile returns the calculated dhcp header: "file" value. see https://datatracker.ietf.org/doc/html/rfc2131#section-2 .
func (Info) ClientTypeFrom ¶
func (i Info) ClientTypeFrom() ClientType
func (Info) IPXEBinaryFrom ¶
func (Info) NextServer ¶
NextServer returns the calculated dhcp header (ServerIPAddr): "siaddr" value. see https://datatracker.ietf.org/doc/html/rfc2131#section-2 .
func (Info) UserClassFrom ¶
type UserClass ¶
type UserClass string
UserClass is DHCP option 77 (https://www.rfc-editor.org/rfc/rfc3004.html).
const ( // If the client has had iPXE burned into its ROM (or is a VM // that uses iPXE as the PXE "ROM"), special handling is // needed because in this mode the client is using iPXE native // drivers and chainloading to a UNDI stack won't work. IPXE UserClass = "iPXE" // If the client identifies as "Tinkerbell", we've already // chainloaded this client to the full-featured copy of iPXE // we supply. We have to distinguish this case so we don't // loop on the chainload step. Tinkerbell UserClass = "Tinkerbell" )
known user-class types. must correspond to DHCP option 77 - User-Class https://www.rfc-editor.org/rfc/rfc3004.html
Directories ¶
Path | Synopsis |
---|---|
Package data is an interface between DHCP backend implementations and the DHCP server.
|
Package data is an interface between DHCP backend implementations and the DHCP server. |
Package handler holds the interface that backends implement, handlers take in, and the top level dhcp package passes to handlers.
|
Package handler holds the interface that backends implement, handlers take in, and the top level dhcp package passes to handlers. |
proxy
Package proxy implements a DHCP handler that provides proxyDHCP functionality.
|
Package proxy implements a DHCP handler that provides proxyDHCP functionality. |
reservation
Package noop is a backend handler that does nothing.
|
Package noop is a backend handler that does nothing. |
Package otel handles translating DHCP headers and options to otel key/value attributes.
|
Package otel handles translating DHCP headers and options to otel key/value attributes. |
Package dhcp providers UDP listening and serving functionality.
|
Package dhcp providers UDP listening and serving functionality. |