entity

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWoLPort       = 9
	DefaultNUTServerPort = 3493
)

Variables

View Source
var (
	ErrorUsernameRequired  = errors.New("username is required")
	ErrorPasswordRequired  = errors.New("password is required")
	ErrorInvalidPort       = errors.New("port must be between 1 and 65535")
	ErrorNameRequired      = errors.New("name is required")
	ErrorHostRequired      = errors.New("host is required")
	ErrorMACRequired       = errors.New("MAC is required")
	ErrorInvalidMac        = errors.New("MAC address is invalid")
	ErrorInvalidHost       = errors.New("host is invalid, must be an IP address or hostname")
	ErrorBroadcastRequired = errors.New("broadcast is required")
	ErrorInvalidBroadcast  = errors.New("broadcast is invalid, must be an IP address")
	ErrorIntervalRequired  = errors.New("interval is required")
	ErrorInvalidInterval   = errors.New("interval is invalid, must be a duration")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	NutServers []NutServer
}

func (*Config) Validate

func (c *Config) Validate() error

type ConfigLoader

type ConfigLoader interface {
	Load() (*Config, error)
}

type NutServer

type NutServer struct {
	Name     string
	Host     string
	Port     int
	Username string
	Password string
	Targets  []TargetServer
}

func (*NutServer) Validate

func (ns *NutServer) Validate() error

type NutServerInterface

type NutServerInterface interface {
	Validate() error
	GetJSON() (string, error)
	NutServer
}

type TargetServer

type TargetServer struct {
	Name      string
	MAC       string
	Broadcast string
	Port      int    `default:"9"`
	Interval  string `default:"15m"`
	Rules     []string
}

func NewTargetServer

func NewTargetServer(name, mac, broadcast, interval string, 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