smee

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 31 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
	DefaultTFFTPSinglePort = true
	DefaultTFFTPTimeout    = 10 * time.Second
	DefaultDHCPPort        = 67
	DefaultSyslogPort      = 514
	DefaultHTTPPort        = 7171
	DefaultHTTPSPort       = 7272
	DefaultTinkServerPort  = 42113

	IPXEBinaryURI  = "/ipxe/binary/"
	IPXEScriptURI  = "/ipxe/script/"
	ISOURI         = "/iso/"
	HealthCheckURI = "/healthcheck"
	MetricsURI     = "/metrics"
)

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.Hardware, error)
	GetByIP(context.Context, net.IP) (data.Hardware, 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
	// HTTP is the configuration for the HTTP service.
	HTTP HTTP
	// TLS is the configuration for TLS.
	TLS TLS
}

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 configures whether the DHCP server is enabled.
	Enabled bool
	// EnableNetbootOptions configures whether sending netboot options is enabled.
	EnableNetbootOptions 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 is the URL to the iPXE binary server serving via HTTP.
	IPXEHTTPBinaryURL *url.URL
	// IPXEHTTPScript is the URL to the iPXE script to use.
	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 HTTP added in v0.22.0

type HTTP struct {
	// BindHTTPSPort is the local port to listen on for the HTTPS server.
	BindHTTPSPort uint16
}

type IPXE

type IPXE struct {
	EmbeddedScriptPatch string
	HTTPBinaryServer    IPXEHTTPBinaryServer
	HTTPScriptServer    IPXEHTTPScriptServer

	// IPXEBinary are the options to use when serving iPXE binaries via TFTP or HTTP.
	IPXEBinary IPXEHTTPBinary
}

type IPXEHTTPBinary added in v0.20.0

type IPXEHTTPBinary struct {
	// InjectMacAddrFormat is the format to use when injecting the mac address into the iPXE binary URL.
	// Valid values are "colon", "dot", "dash", "no-delimiter", and "empty".
	// For example, colon: http://1.2.3.4/ipxe/ipxe.efi -> http://1.2.3.4/ipxe/40:15:ff:89:cc:0e/ipxe.efi
	InjectMacAddrFormat constant.MACFormat
	// IPXEArchMapping will override the default architecture to binary mapping.
	IPXEArchMapping map[iana.Arch]constant.IPXEBinary
}

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
	// SinglePort configures whether to use single-port TFTP mode.
	SinglePort bool
	// 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 TLS added in v0.22.0

type TLS struct {
	Certs []tls.Certificate
}

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.
http
package http handles serving HTTP(s) requests, HTTP middleware, and defines common handlers.
package http handles serving HTTP(s) requests, HTTP middleware, and defines common handlers.
ipxe/binary/file
Package binary handles embedding of the iPXE binaries.
Package binary handles embedding of the iPXE binaries.
iso

Jump to

Keyboard shortcuts

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