server

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_ADDRESS = "127.0.0.1"
View Source
const DEFAULT_HOSTNAME = "netboot.local"
View Source
const DEFAULT_PORT = "2014"
View Source
const Version = "1.0.0"

Variables

View Source
var IPXE_PATTERN = regexp.MustCompile(`^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})\.ipxe$`)
View Source
var MAC_PATTERN = regexp.MustCompile(`^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$`)
View Source
var PKG_PATTERN = regexp.MustCompile(`^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})\.tgz$`)

Functions

func FormatJSON

func FormatJSON(v any) string

func IsDir

func IsDir(path string) bool

func IsFile

func IsFile(pathname string) bool

Types

type AddResponse

type AddResponse struct {
	Message string   `json:"message"`
	Output  []string `json:"output"`
}

type Config

type Config struct {
	Address           string `json:"address"`
	OS                string `json:"os"`
	Version           string `json:"version"`
	Serial            string `json:"serial"`
	Config            string `json:"config"`
	DisklabelTemplate string `json:"disklabel_template"`
}

type CpioFile

type CpioFile struct {
	Name string
	Body string
}

type DeleteResponse

type DeleteResponse struct {
	Message string   `json:"message"`
	Files   []string `json:"files"`
}

type Host

type Host struct {
	Address string `json:"address"`
}

type HostAddressResponse

type HostAddressResponse struct {
	MAC string `json:"mac"`
	IP  string `json:"ip"`
}

type HostCache

type HostCache struct {
	// contains filtered or unexported fields
}

func NewHostCache

func NewHostCache(dir string) (*HostCache, error)

func (*HostCache) AddHostHandler

func (c *HostCache) AddHostHandler(w http.ResponseWriter, r *http.Request)

func (*HostCache) DefaultHandler

func (c *HostCache) DefaultHandler(w http.ResponseWriter, r *http.Request)

func (*HostCache) DeleteHostHandler

func (c *HostCache) DeleteHostHandler(w http.ResponseWriter, r *http.Request)

func (*HostCache) HostAddressQueryHandler

func (c *HostCache) HostAddressQueryHandler(w http.ResponseWriter, r *http.Request)

func (*HostCache) HostBootedHandler

func (c *HostCache) HostBootedHandler(w http.ResponseWriter, r *http.Request)

func (*HostCache) ListHostsHandler

func (c *HostCache) ListHostsHandler(w http.ResponseWriter, r *http.Request)

func (*HostCache) UploadPackageHandler

func (c *HostCache) UploadPackageHandler(w http.ResponseWriter, r *http.Request)

type HostListResponse

type HostListResponse struct {
	Message   string   `json:"message"`
	Addresses []string `json:"addresses"`
}

type InitFile

type InitFile struct {
	Name string
	Data []byte
	Mode fs.FileMode
	UID  int
	GID  int
}

type Initrd

type Initrd struct {
	// contains filtered or unexported fields
}

func NewInitrd

func NewInitrd(r io.Reader) (*Initrd, error)

func (*Initrd) AddFile

func (i *Initrd) AddFile(name string, data []byte, mode fs.FileMode, uid, gid int) error

func (*Initrd) Close

func (i *Initrd) Close() error

func (*Initrd) Write

func (i *Initrd) Write(w io.Writer) error

type MkBoot

type MkBoot struct {
	Config            *Config
	Dir               string
	Tarball           string
	Response          string
	DiskLabelTemplate string
}

func NewMkBoot

func NewMkBoot(config *Config, dir, tarball, response, diskLabelTemplate string) *MkBoot

func (*MkBoot) Generate

func (m *MkBoot) Generate() ([]string, error)

type Options

type Options struct {
	Hostname string
	Address  string
	Port     int
	CacheDir string
}

type Response

type Response struct {
	Message string `json:"message"`
}

type Server

type Server struct {
	Hostname string
	Address  string
	Port     int

	NetbootDir string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(options *Options) (*Server, error)

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop() error

func (*Server) Wait

func (s *Server) Wait() error

Jump to

Keyboard shortcuts

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