smee

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 26 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DHCPModeProxy       DHCPMode = "proxy"
	DHCPModeReservation DHCPMode = "reservation"
	DHCPModeAutoProxy   DHCPMode = "auto-proxy"

	// Defaults consumers can use.
	DefaultTFFTPPort      = 69
	DefaultTFFTPBlockSize = 512
	DefaultTFFTPTimeout   = 10 * time.Second

	DefaultDHCPMode = DHCPModeReservation

	DefaultSyslogPort = 514

	DefaultHTTPPort = 7171

	DefaultTinkServerPort = 42113
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendReader

type BackendReader interface {
	// Read data (from a backend) based on a mac address
	// and return DHCP headers and options, including netboot info.
	GetByMac(context.Context, net.HardwareAddr) (*data.DHCP, *data.Netboot, error)
	GetByIP(context.Context, net.IP) (*data.DHCP, *data.Netboot, error)
}

BackendReader is the interface for getting data from a backend.

type Config

type Config struct {
	// Backend is the backend to use for getting data.
	Backend BackendReader
	// DHCP is the configuration for the DHCP service.
	DHCP DHCP
	// IPXE is the configuration for the iPXE service.
	IPXE IPXE
	// ISO is the configuration for the ISO service.
	ISO ISO
	// OTEL is the configuration for OpenTelemetry.
	OTEL OTEL
	// Syslog is the configuration for the syslog service.
	Syslog Syslog
	// TFTP is the configuration for the TFTP service.
	TFTP TFTP
	// TinkServer is the configuration for the Tinkerbell server.
	TinkServer TinkServer
}

Config is the configuration for the Smee service.

func NewConfig

func NewConfig(c Config, publicIP netip.Addr) *Config

NewConfig is a constructor for the Config struct. It will set default values for the Config struct. Boolean fields are not set-able via c. To set boolean, modify the returned Config struct.

func (*Config) Start

func (c *Config) Start(ctx context.Context, log logr.Logger) error

Start will run Smee services. Enabling and disabling services is controlled by the Config struct.

func (*Config) Transformer

func (c *Config) Transformer(typ reflect.Type) func(dst, src reflect.Value) error

Transformer for merging the netip.IPPort and logr.Logger structs.

type DHCP

type DHCP struct {
	Enabled bool
	// Mode determines the behavior of the DHCP server.
	// See the DHCPMode type for valid values.
	Mode DHCPMode
	// BindAddr is the local address to which to bind the DHCP server and listen for DHCP packets.
	BindAddr netip.Addr
	BindPort uint16
	// BindInterface is the local interface to which to bind the DHCP server and listen for DHCP packets.
	BindInterface string
	// IPForPacket is the IP address to use in the DHCP packet for DHCP option 54.
	IPForPacket netip.Addr
	// SyslogIP is the IP address to use in the DHCP packet for DHCP option 7.
	SyslogIP netip.Addr
	// TFTPIP is the IP address to use in the DHCP packet for DHCP option 66.
	TFTPIP netip.Addr
	// TFTPPort is the port to use in the DHCP packet for DHCP option 66.
	TFTPPort uint16
	//
	IPXEHTTPBinaryURL *url.URL
	IPXEHTTPScript    IPXEHTTPScript
}

type DHCPMode

type DHCPMode string

func (*DHCPMode) Set

func (d *DHCPMode) Set(s string) error

func (DHCPMode) String

func (d DHCPMode) String() string

func (*DHCPMode) Type

func (d *DHCPMode) Type() string

type IPXE

type IPXE struct {
	EmbeddedScriptPatch string
	HTTPBinaryServer    IPXEHTTPBinaryServer
	HTTPScriptServer    IPXEHTTPScriptServer
}

type IPXEHTTPBinaryServer

type IPXEHTTPBinaryServer struct {
	Enabled bool
}

type IPXEHTTPScript

type IPXEHTTPScript struct {
	URL *url.URL
	// InjectMacAddress will prepend the hardware mac address to the ipxe script URL file name.
	// For example: http://1.2.3.4/my/loc/auto.ipxe -> http://1.2.3.4/my/loc/40:15:ff:89:cc:0e/auto.ipxe
	// Setting this to false is useful when you are not using the auto.ipxe script in Smee.
	InjectMacAddress bool
}

type IPXEHTTPScriptServer

type IPXEHTTPScriptServer struct {
	Enabled         bool
	BindAddr        netip.Addr
	BindPort        uint16
	Retries         int
	RetryDelay      int
	OSIEURL         *url.URL
	TrustedProxies  []string
	ExtraKernelArgs []string
}

type ISO

type ISO struct {
	Enabled           bool
	UpstreamURL       *url.URL
	PatchMagicString  string
	StaticIPAMEnabled bool
}

type OTEL

type OTEL struct {
	Endpoint         string
	InsecureEndpoint bool
}

type Syslog

type Syslog struct {
	// BindAddr is the local address to which to bind the syslog server.
	BindAddr netip.Addr
	// BindPort is the local port to which to bind the syslog server.
	BindPort uint16
	// Enabled is a flag to enable or disable the syslog server.
	Enabled bool
}

type TFTP

type TFTP struct {
	// BindAddr is the local address to which to bind the TFTP server.
	BindAddr netip.Addr
	// BindPort is the local port to which to bind the TFTP server.
	BindPort uint16
	// BlockSize is the block size to use when serving TFTP requests.
	BlockSize int
	// Timeout is the timeout for each serving each TFTP request.
	Timeout time.Duration
	// Enabled is a flag to enable or disable the TFTP server.
	Enabled bool
}

type TinkServer

type TinkServer struct {
	UseTLS      bool
	InsecureTLS bool
	AddrPort    string
}

Directories

Path Synopsis
internal
dhcp/handler/proxy
Package proxy implements a DHCP handler that provides proxyDHCP functionality.
Package proxy implements a DHCP handler that provides proxyDHCP functionality.
dhcp/handler/reservation
Package noop is a backend handler that does nothing.
Package noop is a backend handler that does nothing.
dhcp/otel
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.
dhcp/server
Package dhcp providers UDP listening and serving functionality.
Package dhcp providers UDP listening and serving functionality.
ipxe/binary/file
Package binary handles embedding of the iPXE binaries.
Package binary handles embedding of the iPXE binaries.
ipxe/http
package bhttp is the http server for smee.
package bhttp is the http server for smee.
iso

Jump to

Keyboard shortcuts

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