pixie

package
v0.0.0-...-a4b2caf Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHTTPListener = ":8880"
	DefaultTFTPListener = ":69"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Boot

type Boot struct {
	Name       string
	Devices    []Device
	Script     string
	ScriptPath string
	Vars       Vars
}

Boot is an iPXE script, templatable with Vars, that will be used for each of the Devices. If Script is not empty, its contents will be used. Otherwise, the contents are loaded from ScriptPath.

type Device

type Device struct {
	Name string
	Mac  string
	Vars Vars
}

Device is a device that will be booted using pixie.

type RenderConfig

type RenderConfig struct {
	Boot   *Boot
	Device *Device

	// Vars is the merged Vars map. See [NewRenderConfig] for details.
	Vars Vars
}

RenderConfig is what will be passed to text/template when a file is rendered.

func NewRenderConfig

func NewRenderConfig(baseVars map[string]string, boot *Boot, device *Device) *RenderConfig

NewRenderConfig returns a RenderConfig containing the boot and device, as well as the merged Vars map. Values in device.Vars override values in boot.Vars, which override values in baseVars.

func (*RenderConfig) Render

func (r *RenderConfig) Render(tmpl []byte) (string, error)

Render renders the template content tmpl, providing the r as data.

type Server

type Server struct {
	Boots        []Boot
	Vars         map[string]string
	StaticRoot   string
	HTTPListener string
	TFTPListener string
}

Server is a pixie server configuration.

func (*Server) Listen

func (s *Server) Listen() error

Listen starts an HTTP server (for the API) and a TFTP server, and blocks until either of them exit.

func (*Server) NewRenderConfig

func (s *Server) NewRenderConfig(mac string) (*RenderConfig, error)

NewRenderConfig will return a RenderConfig for the boot/device associated with the given MAC address.

func (*Server) RenderScript

func (s *Server) RenderScript(mac string) (string, error)

RenderScript will render the script associated with the provided MAC address using text/template. A RenderConfig is created and used when rendering the template.

type Vars

type Vars map[string]string

Vars contains the variables available to templates rendered by pixie.

Jump to

Keyboard shortcuts

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