Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultNUTPort = 3493 DefaultWoLPort = 9 DefaultConfigName = "config" DefaultConfigExt = "yaml" )
Variables ¶
View Source
var (
DefaultConfigFile = fmt.Sprintf("%s.%s", DefaultConfigName, DefaultConfigExt)
)
Functions ¶
func IsRegoFile ¶
func IsRegoFile(fl validator.FieldLevel) bool
Types ¶
type Config ¶
type Config struct {
NutServers []NutServer `yaml:"nut_servers"`
}
func CreateDefaultConfig ¶
func CreateDefaultConfig() Config
func (*Config) FindTarget ¶
func (c *Config) FindTarget(mac string) (*TargetServer, *NutServer, error)
type NutCredentials ¶
type NutCredentials struct { Username string `yaml:"username" validate:"required"` Password string `yaml:"password" validate:"required"` }
func (*NutCredentials) Validate ¶
func (cred *NutCredentials) Validate() error
type NutServer ¶
type NutServer struct { Name string `yaml:"name" validate:"required"` Host string `yaml:"host" validate:"required,ip|hostname"` Port int `yaml:"port" validate:"omitempty,gte=1,lte=65535"` Credentials NutCredentials `yaml:"credentials" validate:"required"` Targets []TargetServer `yaml:"targets" validate:"omitempty"` }
type TargetServer ¶
type TargetServer struct { Name string `yaml:"name" validate:"required"` Mac string `yaml:"mac" validate:"required,mac"` Broadcast string `yaml:"broadcast" validate:"required,ip"` Port int `yaml:"port" validate:"omitempty,gte=1,lte=65535" default:"9"` Interval string `yaml:"interval" validate:"required,duration" default:"15m"` Rules []string `yaml:"rules" validate:"omitempty,dive,regofile"` }
func (*TargetServer) Validate ¶
func (ts *TargetServer) Validate() error
Click to show internal directories.
Click to hide internal directories.