manifest

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentContext

type ContentContext struct {
	// Address of netbootd server
	LocalIP net.IP
	// Address of client
	RemoteIP net.IP
	// Base URL to the HTTP service (IP and port) - not API
	HttpBaseUrl *url.URL
	// Copy of Manifest
	Manifest *Manifest
}

ContentContext is the template context available for static Content embedded in Manifests.

type HardwareAddr

type HardwareAddr []byte

A HardwareAddr represents a physical hardware address.

func ParseMAC

func ParseMAC(s string) (hw HardwareAddr, err error)

ParseMAC parses s as an IEEE 802 MAC-48, EUI-48, EUI-64, or a 20-octet IP over InfiniBand link-layer address using one of the following formats:

00:00:5e:00:53:01
02:00:5e:10:00:00:00:01
00:00:00:00:fe:80:00:00:00:00:00:00:02:00:5e:10:00:00:00:01
00-00-5e-00-53-01
02-00-5e-10-00-00-00-01
00-00-00-00-fe-80-00-00-00-00-00-00-02-00-5e-10-00-00-00-01
0000.5e00.5301
0200.5e10.0000.0001
0000.0000.fe80.0000.0000.0000.0200.5e10.0000.0001

func (HardwareAddr) MarshalText

func (a HardwareAddr) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler using the standard string representation of a HardwareAddr.

func (HardwareAddr) String

func (a HardwareAddr) String() string

func (*HardwareAddr) UnmarshalText

func (a *HardwareAddr) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type IPWithNet

type IPWithNet struct {
	IP  net.IP
	Net net.IPNet
}

func (*IPWithNet) MarshalText

func (n *IPWithNet) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler using the standard CIDR representation of a IPNet.

func (*IPWithNet) Netmask

func (n *IPWithNet) Netmask() string

func (*IPWithNet) String

func (n *IPWithNet) String() string

func (*IPWithNet) UnmarshalText

func (n *IPWithNet) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Manifest

type Manifest struct {
	ID            string        `yaml:"id"`
	IPv4          IPWithNet     `yaml:"ipv4"`
	Hostname      string        `yaml:"hostname"`
	Domain        string        `yaml:"domain"`
	LeaseDuration time.Duration `yaml:"leaseDuration"`
	MAC           []HardwareAddr
	DNS           []net.IP
	Router        []net.IP
	NTP           []net.IP
	Ipxe          bool
	BootFilename  string `yaml:"bootFilename"`
	Mounts        []Mount
	Suspended     bool
}

Manifest represents user-supplied per-host manifest information. go-yaml accepts completely lowercase version of keys but is not case-insensitive https://github.com/go-yaml/yaml/issues/123 some fields are forcefully mapped to camelCase instead of CamelCase and camelcase

func ManifestFromJson

func ManifestFromJson(content []byte) (manifest Manifest, err error)

func ManifestFromYaml

func ManifestFromYaml(content []byte) (manifest Manifest, err error)

func (*Manifest) GetMount

func (m *Manifest) GetMount(path string) (Mount, error)

GetMount returns best matching Mount, respecting exact and prefix-based mount paths. Longest path match is considered "best". If the path in the Mount or being matched begins with a slash (/), it is ignored.

func (*Manifest) ToJson

func (m *Manifest) ToJson() ([]byte, error)

func (*Manifest) ToYaml

func (m *Manifest) ToYaml() ([]byte, error)

func (Manifest) Validate added in v0.2.0

func (m Manifest) Validate() error

type Mount

type Mount struct {
	// Path at which to select this mount.
	Path string

	// If Prefix is set to true, the Path is treated as a prefix.
	PathIsPrefix bool `yaml:"pathIsPrefix"`

	// The proxy destination used when handling requests.
	// Mutually exclusive with Content option.
	Proxy string
	// If PathIsPrefix is true and AppendSuffix is true, the suffix to Path Prefix will also be appended to Proxy Or LocalDir.
	// Otherwise, it will be many to one proxy.
	AppendSuffix bool `yaml:"appendSuffix"`

	// Provides content template (passed through template/text) to serve.
	// Mutually exclusive with Proxy option.
	Content string

	// Provides a path on the host to find the files.
	// So that LocalDir: /tftpboot path: /subdir and client requests: /subdir/file.x the path on the host
	// becomes /tfptboot/file.x
	LocalDir string `yaml:"localDir"`
}

Mount represents a path exposed via TFTP and HTTP.

func (Mount) ProxyDirector

func (m Mount) ProxyDirector() (func(req *http.Request), error)

Jump to

Keyboard shortcuts

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