server

package
v0.0.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DEFAULT_ADDRESS = "127.0.0.1"
View Source
const DEFAULT_ALPINE_MIRROR = "https://dl-cdn.alpinelinux.org"
View Source
const DEFAULT_DEBIAN_MIRROR = "http://ftp.us.debian.org"
View Source
const DEFAULT_DEBIAN_SECURITY_MIRROR = "http://security.debian.org"
View Source
const DEFAULT_HOSTNAME = "netboot.local"
View Source
const DEFAULT_HTTPS_PORT = "4443"
View Source
const DEFAULT_HTTP_PORT = "4444"
View Source
const DEFAULT_OPENBSD_MIRROR = "https://mirrors.mit.edu"
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 TARBALL_PATTERN = regexp.MustCompile(`^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})\.tgz$`)

Functions

func CopyFile added in v0.0.7

func CopyFile(dstPathname, srcPathname string) error

func CopyFileFromFS added in v0.0.7

func CopyFileFromFS(dstPathname, srcPathname string, srcFS fs.FS) error

func DownloadFileRoot added in v0.0.7

func DownloadFileRoot(root *os.Root, mirrorUrl, requestPath string) (string, error)

func ExtractTarballFile added in v0.0.7

func ExtractTarballFile(dstPath, srcPath, tarPath string) error

func Fatal added in v0.0.3

func Fatal(err error) error

func Fatalf added in v0.0.3

func Fatalf(format string, args ...interface{}) error

func FormatJSON

func FormatJSON(v any) string

func GenerateInitrd added in v0.0.3

func GenerateInitrd(outputName, inputName string, fileNames []string) error

func IsDir

func IsDir(path string) bool

func IsDirFS added in v0.0.7

func IsDirFS(filesystem fs.FS, pathname string) bool

func IsDirRoot added in v0.0.7

func IsDirRoot(root *os.Root, pathname string) bool

func IsFile

func IsFile(path string) bool

func IsFileFS added in v0.0.7

func IsFileFS(filesystem fs.FS, pathname string) bool

func IsFileRoot added in v0.0.7

func IsFileRoot(root *os.Root, pathname string) bool

func MkdirAllRoot added in v0.0.7

func MkdirAllRoot(root *os.Root, pathname string) error

func UnzipFile added in v0.0.4

func UnzipFile(filename string) (string, error)

func Warning added in v0.0.7

func Warning(format string, args ...interface{})

func ZipFile added in v0.0.4

func ZipFile(filename string) (string, error)

Types

type AddResponse

type AddResponse struct {
	Message string   `json:"message"`
	ISO     string   `json: "iso"`
	Files   []string `json:"files"`
}

type Config

type Config struct {
	Address           string `json:"address"`
	OS                string `json:"os"`
	Version           string `json:"version"`
	Arch              string `json:"arch"`
	Serial            string `json:"serial"`
	Response          string `json:"response"`
	DisklabelTemplate string `json:"disklabel_template"`
	KernelParams      string `json:"kernel_params"`
}

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) AlpineHandler added in v0.0.7

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

func (*HostCache) DebianHandler added in v0.0.3

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

func (*HostCache) DebianSecurityHandler added in v0.0.7

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

func (*HostCache) DeleteHostHandler

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

func (*HostCache) GDLHandler added in v0.0.7

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

func (*HostCache) GenerateISO added in v0.0.3

func (c *HostCache) GenerateISO(tempDir, url string, bootFiles []string, config *Config) (string, error)

Generate a url-customized netboot ISO returning generated iso pathname

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) IPXEHandler added in v0.0.3

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

func (*HostCache) IPXEHandlerTLS added in v0.0.7

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

func (*HostCache) ListHostsHandler

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

func (*HostCache) OpenBSDHandler added in v0.0.3

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

func (*HostCache) RootHandler added in v0.0.5

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

func (*HostCache) UTCHandler added in v0.0.7

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

func (*HostCache) UploadPackageHandler

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

func (*HostCache) VersionHandler added in v0.0.7

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

type HostListResponse

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

type InitFile

type InitFile struct {
	DstName string
	SrcName string
	Mode    fs.FileMode
	UID     int
	GID     int
}

type MkBoot

type MkBoot struct {
	TempDir   string
	IpxeDir   string
	URL       string
	BootFiles []string
	Config    *Config
	ISO       string
}

func NewMkBoot

func NewMkBoot(tempDir, ipxeDir, url string, bootFiles []string, config *Config) *MkBoot

func (*MkBoot) Generate

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

prepare OS-specific boot files in the cache directory named with MAC address

type Options

type Options struct {
	Hostname  string
	Address   string
	HttpPort  int
	HttpsPort int
	CacheDir  string
}

type Record added in v0.0.4

type Record struct {
	Header cpio.Header
	Data   []byte
}

type Response

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

type Server

type Server struct {
	Hostname  string
	Address   string
	HttpsPort int
	HttpPort  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