entity

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWoLPort       = 9
	DefaultNUTServerPort = 3493
)

Variables

View Source
var (
	ErrCertFilesNotSet    = errors.New("SSL is enabled but certFile or keyFile is not set")
	ErrTLSConfigNotSet    = errors.New("TLSConfig cannot be null")
	ErrFailedParsePEM     = errors.New("failed to parse PEM certificate")
	ErrFailedReadCertFile = errors.New("failed to read certificate file")
)
View Source
var (
	ErrUsernameRequired  = errors.New("username is required")
	ErrPasswordRequired  = errors.New("password is required")
	ErrInvalidPort       = errors.New("port must be a number between 1 and 65535")
	ErrNameRequired      = errors.New("name is required")
	ErrHostRequired      = errors.New("host is required")
	ErrMACRequired       = errors.New("MAC is required")
	ErrInvalidMac        = errors.New("MAC address is invalid")
	ErrInvalidHost       = errors.New("host is invalid, must be an IP address or hostname")
	ErrBroadcastRequired = errors.New("broadcast is required")
	ErrInvalidBroadcast  = errors.New("broadcast is invalid, must be an IP address")
	ErrIntervalRequired  = errors.New("interval is required")
	ErrInvalidInterval   = errors.New("interval is invalid, must be a duration")
)

Functions

This section is empty.

Types

type CLIArgs added in v0.8.0

type CLIArgs struct {
	TLSConfig  *tls.Config
	ConfigFile string
	CertFile   string
	KeyFile    string
	Port       string
	Host       net.IP
	UseSSL     bool
}

func NewCLIArgs added in v0.8.0

func NewCLIArgs(fileSystem afero.Fs, configFile string, useSSL bool, certFile, keyFile, host, port string) (*CLIArgs, error)

func (*CLIArgs) Address added in v0.8.0

func (c *CLIArgs) Address() string

func (*CLIArgs) ListenAddress added in v0.9.0

func (c *CLIArgs) ListenAddress() string

func (*CLIArgs) URL added in v0.9.0

func (c *CLIArgs) URL() string

func (*CLIArgs) URLPrefix added in v0.8.0

func (c *CLIArgs) URLPrefix() string

func (*CLIArgs) Validate added in v0.8.0

func (c *CLIArgs) Validate() error

type Config

type Config struct {
	Profiler   *Profiler
	NutServers []*NutServer
}

func CreateDefaultConfig added in v1.1.0

func CreateDefaultConfig() *Config

func (*Config) Validate

func (c *Config) Validate() error

type MacAddress added in v1.2.0

type MacAddress struct {
	MAC string `json:"mac" example:"00:11:22:33:44:55"`
}

func NewMacAddress added in v1.2.0

func NewMacAddress(mac string) (*MacAddress, error)

func (*MacAddress) Validate added in v1.2.0

func (m *MacAddress) Validate() error

type NutServer

type NutServer struct {
	Name     string          `json:"name"`
	Host     string          `json:"host"`
	Username string          `json:"username"`
	Password string          `json:"password"`
	Targets  []*TargetServer `json:"targets"`
	Port     int             `json:"port"`
}

func (*NutServer) Validate

func (ns *NutServer) Validate() error

type Profiler added in v1.2.0

type Profiler struct {
	Enabled bool `json:"enabled" default:"false"`
}

type TargetServer

type TargetServer struct {
	*MacAddress
	Name      string        `json:"name"`
	Broadcast string        `json:"broadcast"`
	Rules     []string      `json:"rules"`
	Interval  time.Duration `json:"interval" default:"900000000000"`
	Port      int           `json:"port" default:"9"`
}

func NewTargetServer

func NewTargetServer(name, mac, broadcast string, interval time.Duration, port int, rules []string) (*TargetServer, error)

func (*TargetServer) Validate

func (ts *TargetServer) Validate() error

Jump to

Keyboard shortcuts

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