Documentation
¶
Index ¶
- Constants
- Variables
- func AppendConfig(filename string) error
- func CheckErr(err error)
- func CobraAddCommand(cobraRootCmd, parentCmd, cobraCmd CobraCommand)
- func CobraInit(cobraRootCmd CobraCommand)
- func ConfigDir() string
- func ConfigEdit()
- func ConfigInit(allowClobber bool) string
- func ConfigString(header bool) string
- func Confirm(prompt string) bool
- func CreateEFIImage(dstImage, efiBin, autoexec string) error
- func DefaultDist(os string) (string, string, string, error)
- func DownloadFileRoot(root *os.Root, mirrorUrl, requestPath string) (string, []byte, error)
- func Expand(value string) string
- func Fatal(err error) error
- func Fatalf(format string, args ...interface{}) error
- func FormatJSON(v any) string
- func FormatMAC(mac, separator string) (string, error)
- func FormatYAML(value any) string
- func GenerateInitrd(outputName, inputName string, fileNames []string) error
- func GetHostnameDetail() (string, string, string, error)
- func HexDump(data []byte) string
- func HostDomain() (string, error)
- func HostFQDN() (string, error)
- func HostShortname() (string, error)
- func Init(name, version, configFile string)
- func IsDir(path string) bool
- func IsDirRoot(root *os.Root, pathname string) bool
- func IsFile(pathname string) bool
- func IsFileRoot(root *os.Root, pathname string) bool
- func MkdirAllRoot(root *os.Root, pathname string) error
- func OptionInt(cobraCmd CobraCommand, name, flag string, defaultValue int, description string)
- func OptionKey(cobraCmd CobraCommand, key string) string
- func OptionString(cobraCmd CobraCommand, name, flag, defaultValue, description string)
- func OptionStringSlice(cobraCmd CobraCommand, name, flag string, defaultValue []string, ...)
- func OptionSwitch(cobraCmd CobraCommand, name, flag, description string)
- func ProgramName() string
- func ProgramVersion() string
- func SemverSort(unsorted []string, pattern *regexp.Regexp) ([]string, error)
- func Shutdown()
- func TildePath(path string) (string, error)
- func ViperGet(key string) any
- func ViperGetBool(key string) bool
- func ViperGetInt(key string) int
- func ViperGetInt64(key string) int64
- func ViperGetString(key string) string
- func ViperGetStringMapString(key string) map[string]string
- func ViperGetStringSlice(key string) []string
- func ViperKey(key string) string
- func ViperSet(key string, value any)
- func ViperSetDefault(key string, value any)
- func Warning(format string, args ...interface{})
- type APIClient
- type CobraCommand
- type Host
- type HostCache
- func (c *HostCache) AddHostHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) AddIsoKeyHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) AddWhitelistAddressHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) AlpineHandler(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) AlpineHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) CheckUploadCache(mirror string, w http.ResponseWriter, r *http.Request) bool
- func (c *HostCache) DebianHandler(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) DebianHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) DebianSecurityHandler(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) DebianSecurityHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) DeleteDistHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) DeleteHostHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) DeleteIsoKeyHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) DeleteWhitelistAddressHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) GDLHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) GenerateISO(tempDir, url, httpUrl string, config *message.NetbootConfig) (string, []string, error)
- func (c *HostCache) GetDistHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) GetHostSetStatusHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) HostAddressQueryHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) IPXEHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) ISOHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) ListHostsHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) OpenBSDHandler(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) OpenBSDHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) PNGHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) PutBootstrapHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) PutHostStatusHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) RootHandler(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) RootHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) SanBootHandler(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) ShutdownHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) UTCHandler(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) UTCHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) UploadDistHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) UploadPackageHandlerTLS(w http.ResponseWriter, r *http.Request)
- func (c *HostCache) VersionHandlerTLS(w http.ResponseWriter, r *http.Request)
- type InitFile
- type MkBoot
- type NetbootServer
- type Record
- type Sendmail
- type Template
Constants ¶
View Source
const BOOTSTRAP_MAC_ADDRESS = "000000000000"
View Source
const DEFAULT_ALPINE_MIRROR = "https://dl-cdn.alpinelinux.org"
View Source
const DEFAULT_BIND_ADDRESS = "127.0.0.1"
View Source
const DEFAULT_DEBIAN_MIRROR = "http://ftp.us.debian.org"
mirrors used by netboot proxy feature
View Source
const DEFAULT_DEBIAN_SECURITY_MIRROR = "http://security.debian.org"
View Source
const DEFAULT_HTTPS_PORT = "4443"
View Source
const DEFAULT_HTTP_PORT = "4444"
View Source
const DEFAULT_ISO_KEY_LIFETIME = 600
View Source
const DEFAULT_MAX_DIST_UPLOAD_MB = 1024
View Source
const DEFAULT_OPENBSD_MIRROR = "https://ftp.openbsd.org"
View Source
const DEFAULT_SERVER_NAME = "localhost"
View Source
const DEFAULT_SHUTDOWN_TIMEOUT_SECONDS = 10
View Source
const DEFAULT_WHITELIST_LIFETIME = 3600
View Source
const GENERATE_IMAGE = true
View Source
const NO_GENERATE_IMAGE = false
View Source
const Version = "1.3.7"
Variables ¶
View Source
var ALPINE_VERSION_PATTERN = regexp.MustCompile(`([0-9][0-9]*)\.([0-9][0-9]*)\.([0-9][0-9]*)$`)
View Source
var APKOVL_PATTERN = regexp.MustCompile(`^([0-9A-Fa-f]{2}[:-]{0,1}){5}([0-9A-Fa-f]{2})\.apkovl\.tar\.gz$`)
View Source
var DIST_DELETE_PATTERNS []*regexp.Regexp = []*regexp.Regexp{ regexp.MustCompile(`^pub/alpine(/.*)*`), regexp.MustCompile(`^pub/debian(/.*)*`), regexp.MustCompile(`^pub/OpenBSD(/.*)*`), regexp.MustCompile(`^pub/windows(/.*)*`), }
View Source
var DIST_TREE_PATTERNS []*regexp.Regexp = []*regexp.Regexp{ regexp.MustCompile(`.*`), }
View Source
var DIST_UPLOAD_PATTERNS []*regexp.Regexp = []*regexp.Regexp{ regexp.MustCompile(`^pub/alpine/\d\.\d\.\d/x86_64/[[:word:].-]+`), regexp.MustCompile(`^pub/debian/[a-z]+/amd64/[[:word:].-]+`), regexp.MustCompile(`^pub/OpenBSD/\d\.\d/packages/amd64/[[:word:].-]+`), regexp.MustCompile(`^pub/windows/\d+/x64/[[:word:].-]+`), }
View Source
var GDL_VERSION_PATTERN = regexp.MustCompile(`^pub/.*/rstms-gdl-(\d+)\.(\d+)\.(\d+).*\.tgz$`)
View Source
var IPXE_PATTERN = regexp.MustCompile(`^([0-9A-Fa-f]{2}[:-]{0,1}){5}([0-9A-Fa-f]{2})\.ipxe$`)
View Source
var InternalShutdownRequest chan struct{}
View Source
var MAC_ISO_PATTERN = regexp.MustCompile(`^([0-9A-Fa-f]{2}[:-]{0,1}){5}([0-9A-Fa-f]{2})\.iso$`)
View Source
var MAC_PATTERN = regexp.MustCompile(`^([0-9A-Fa-f]{2}[:-]{0,1}){5}([0-9A-Fa-f]{2})$`)
View Source
var NORMALIZED_MAC_PATTERN = regexp.MustCompile(`^[0-9a-f]{12}$`)
View Source
var TARBALL_PATTERN = regexp.MustCompile(`^([0-9a-f]{12})\.tgz$`)
View Source
var VERSION_PATTERN = regexp.MustCompile(`^(\d+)\.(\d+)\.(\d+)$`)
Functions ¶
func AppendConfig ¶ added in v0.1.9
func CobraAddCommand ¶ added in v0.0.14
func CobraAddCommand(cobraRootCmd, parentCmd, cobraCmd CobraCommand)
func CobraInit ¶ added in v0.0.14
func CobraInit(cobraRootCmd CobraCommand)
func ConfigEdit ¶ added in v0.0.14
func ConfigEdit()
func ConfigInit ¶ added in v0.0.14
func ConfigString ¶ added in v0.0.14
func CreateEFIImage ¶ added in v0.1.9
func DownloadFileRoot ¶ added in v0.0.7
func FormatJSON ¶
func FormatYAML ¶ added in v0.1.9
func GenerateInitrd ¶ added in v0.0.3
func HostDomain ¶ added in v0.1.9
func HostShortname ¶ added in v0.1.9
func OptionInt ¶ added in v0.1.4
func OptionInt(cobraCmd CobraCommand, name, flag string, defaultValue int, description string)
func OptionKey ¶ added in v0.0.14
func OptionKey(cobraCmd CobraCommand, key string) string
func OptionString ¶ added in v0.0.14
func OptionString(cobraCmd CobraCommand, name, flag, defaultValue, description string)
func OptionStringSlice ¶ added in v0.1.9
func OptionStringSlice(cobraCmd CobraCommand, name, flag string, defaultValue []string, description string)
func OptionSwitch ¶ added in v0.0.14
func OptionSwitch(cobraCmd CobraCommand, name, flag, description string)
func ProgramName ¶ added in v0.0.14
func ProgramName() string
func ProgramVersion ¶ added in v0.0.14
func ProgramVersion() string
func SemverSort ¶ added in v1.2.38
semver srot a slice of strings using a regex pattern to parse major, minor, patch groups
func ViperGetBool ¶ added in v0.0.14
func ViperGetInt ¶ added in v0.0.14
func ViperGetInt64 ¶ added in v0.0.14
func ViperGetString ¶ added in v0.0.14
func ViperGetStringMapString ¶ added in v0.1.3
func ViperGetStringSlice ¶ added in v0.0.14
func ViperSetDefault ¶ added in v0.0.14
Types ¶
type APIClient ¶ added in v0.1.3
type APIClient interface {
Close()
Get(path string, response interface{}) (string, error)
Post(path string, request, response interface{}, headers *map[string]string) (string, error)
Put(path string, request, response interface{}, headers *map[string]string) (string, error)
Delete(path string, response interface{}) (string, error)
}
type CobraCommand ¶ added in v0.0.14
type CobraCommand interface {
}
type HostCache ¶
type HostCache struct {
Name string
// contains filtered or unexported fields
}
func NewHostCache ¶
func (*HostCache) AddHostHandlerTLS ¶ added in v0.0.10
func (c *HostCache) AddHostHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) AddIsoKeyHandlerTLS ¶ added in v1.1.26
func (c *HostCache) AddIsoKeyHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) AddWhitelistAddressHandlerTLS ¶ added in v1.1.23
func (c *HostCache) AddWhitelistAddressHandlerTLS(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) AlpineHandlerTLS ¶ added in v0.0.10
func (c *HostCache) AlpineHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) CheckUploadCache ¶ added in v1.2.25
func (*HostCache) DebianHandler ¶ added in v0.0.3
func (c *HostCache) DebianHandler(w http.ResponseWriter, r *http.Request)
func (*HostCache) DebianHandlerTLS ¶ added in v0.0.10
func (c *HostCache) DebianHandlerTLS(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) DebianSecurityHandlerTLS ¶ added in v0.0.10
func (c *HostCache) DebianSecurityHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) DeleteDistHandlerTLS ¶ added in v1.2.32
func (c *HostCache) DeleteDistHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) DeleteHostHandlerTLS ¶ added in v0.0.10
func (c *HostCache) DeleteHostHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) DeleteIsoKeyHandlerTLS ¶ added in v1.1.26
func (c *HostCache) DeleteIsoKeyHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) DeleteWhitelistAddressHandlerTLS ¶ added in v1.1.23
func (c *HostCache) DeleteWhitelistAddressHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) GDLHandlerTLS ¶ added in v0.0.10
func (c *HostCache) GDLHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) GenerateISO ¶ added in v0.0.3
func (c *HostCache) GenerateISO(tempDir, url, httpUrl string, config *message.NetbootConfig) (string, []string, error)
Generate a url-customized netboot ISO returning generated iso pathname
func (*HostCache) GetDistHandlerTLS ¶ added in v1.2.33
func (c *HostCache) GetDistHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) GetHostSetStatusHandlerTLS ¶ added in v1.1.54
func (c *HostCache) GetHostSetStatusHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) HostAddressQueryHandlerTLS ¶ added in v0.0.10
func (c *HostCache) HostAddressQueryHandlerTLS(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) ISOHandlerTLS ¶ added in v1.1.24
func (c *HostCache) ISOHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) ListHostsHandlerTLS ¶ added in v0.0.10
func (c *HostCache) ListHostsHandlerTLS(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) OpenBSDHandlerTLS ¶ added in v0.0.10
func (c *HostCache) OpenBSDHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) PNGHandlerTLS ¶ added in v0.0.10
func (c *HostCache) PNGHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) PutBootstrapHandlerTLS ¶ added in v1.1.45
func (c *HostCache) PutBootstrapHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) PutHostStatusHandlerTLS ¶ added in v1.1.45
func (c *HostCache) PutHostStatusHandlerTLS(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) RootHandlerTLS ¶ added in v0.0.10
func (c *HostCache) RootHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) SanBootHandler ¶ added in v0.0.10
func (c *HostCache) SanBootHandler(w http.ResponseWriter, r *http.Request)
FIXME: implement high-performance sanboot request handler
func (*HostCache) ShutdownHandlerTLS ¶ added in v1.0.35
func (c *HostCache) ShutdownHandlerTLS(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) UTCHandlerTLS ¶ added in v0.0.10
func (c *HostCache) UTCHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) UploadDistHandlerTLS ¶ added in v1.2.32
func (c *HostCache) UploadDistHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) UploadPackageHandlerTLS ¶ added in v0.0.10
func (c *HostCache) UploadPackageHandlerTLS(w http.ResponseWriter, r *http.Request)
func (*HostCache) VersionHandlerTLS ¶ added in v0.0.10
func (c *HostCache) VersionHandlerTLS(w http.ResponseWriter, r *http.Request)
type MkBoot ¶
type MkBoot struct {
TempDir string
IpxeDir string
URL string
BootFiles *[]string
Config *message.NetbootConfig
ISO string
}
type NetbootServer ¶ added in v0.1.3
type NetbootServer struct {
Name string
ServerName string
Address string
HttpsPort int
HttpPort int
NetbootDir string
// contains filtered or unexported fields
}
func NewNetbootServer ¶ added in v0.1.3
func NewNetbootServer() (*NetbootServer, error)
func (*NetbootServer) GetConfig ¶ added in v0.1.3
func (s *NetbootServer) GetConfig() map[string]any
func (*NetbootServer) Run ¶ added in v0.1.3
func (s *NetbootServer) Run() error
func (*NetbootServer) Start ¶ added in v0.1.3
func (s *NetbootServer) Start() error
func (*NetbootServer) Stop ¶ added in v0.1.3
func (s *NetbootServer) Stop() error
Click to show internal directories.
Click to hide internal directories.