Version: v0.7.1 Latest Latest

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 14 Imported by: 6




View Source
const (
	// DefaultConfig is the default file path for the uhppoted configuration file
	DefaultConfig = "/etc/uhppoted/uhppoted.conf"
View Source
const ROLLOVER = 100000


This section is empty.



type AWS

type AWS struct {
	Credentials string `conf:"credentials"`
	Profile     string `conf:"profile"`
	Region      string `conf:"region"`

func NewAWS

func NewAWS() *AWS

type Alerts

type Alerts struct {
	QOS      byte `conf:"qos"`
	Retained bool `conf:"retained"`

type Config

type Config struct {
	Devices     DeviceMap `conf:"/^UT0311-L0x\\.([0-9]+)\\.(.*)/"`
	REST        `conf:"rest"`
	MQTT        `conf:"mqtt"`
	AWS         `conf:"aws"`
	HTTPD       `conf:"httpd"`
	WildApricot `conf:"wild-apricot"`
	OpenAPI     `conf:"openapi"`

func NewConfig

func NewConfig() *Config

func (*Config) Load

func (c *Config) Load(path string) error

func (*Config) Read

func (c *Config) Read(r io.Reader) error

func (*Config) Validate

func (c *Config) Validate() error

func (*Config) Write

func (c *Config) Write(w io.Writer) error

type Connection

type Connection struct {
	Broker            string `conf:"broker"`
	ClientID          string `conf:"client.ID"`
	Username          string `conf:"username"`
	Password          string `conf:"password"`
	BrokerCertificate string `conf:"broker.certificate"`
	ClientCertificate string `conf:"client.certificate"`
	ClientKey         string `conf:"client.key"`

type Device

type Device struct {
	Name     string
	Address  *net.UDPAddr
	Rollover uint32
	Doors    []string
	TimeZone string

type DeviceMap

type DeviceMap map[uint32]*Device

func (DeviceMap) MarshalConf

func (f DeviceMap) MarshalConf(tag string) ([]byte, error)

func (*DeviceMap) UnmarshalConf

func (f *DeviceMap) UnmarshalConf(tag string, values map[string]string) (interface{}, error)

type HMAC

type HMAC struct {
	Required bool   `conf:"required"`
	Key      string `conf:"key"`

type HOTP

type HOTP struct {
	Range    uint64 `conf:"range"`
	Secrets  string `conf:"secrets"`
	Counters string `conf:"counters"`

type HTTPD

type HTTPD struct {
	HttpEnabled              bool   `conf:"http.enabled"`
	HttpPort                 uint16 `conf:"http.port"`
	HttpsEnabled             bool   `conf:"https.enabled"`
	HttpsPort                uint16 `conf:"https.port"`
	CACertificate            string `conf:""`
	TLSCertificate           string `conf:"tls.certificate"`
	TLSKey                   string `conf:"tls.key"`
	RequireClientCertificate bool   `conf:"tls.client.certificates.required"`
	Security                 struct {
		Auth          string        `conf:"auth"`
		AuthDB        string        `conf:"local.db"`
		CookieMaxAge  int           `conf:"cookie.max-age"`
		LoginExpiry   string        `conf:"login.expiry"`
		SessionExpiry string        `conf:"session.expiry"`
		StaleTime     time.Duration `conf:"stale-time"`
	} `conf:"security"`
	RequestTimeout time.Duration `conf:"request.timeout"`
	System         struct {
		Controllers string `conf:"controllers"`
		Doors       string `conf:"doors"`
	} `conf:"system"`
	DB struct {
		File  string `conf:"file"`
		Rules struct {
			ACL    string `conf:"acl"`
			System string `conf:"system"`
			Cards  string `conf:"cards"`
		} `conf:"rules"`
	} `conf:"db"`
	Audit struct {
		File string `conf:"file"`
	} `conf:"audit"`
	Retention time.Duration `conf:"retention"`

func NewHTTPD

func NewHTTPD() *HTTPD

type MQTT

type MQTT struct {
	ServerID        string      `conf:"server.ID"`
	Connection      Connection  `conf:"connection"`
	Topics          Topics      `conf:"topic"`
	Alerts          Alerts      `conf:"alerts"`
	EventsKeyID     string      `conf:"events.key"`
	SystemKeyID     string      `conf:"system.key"`
	EventIDs        string      `conf:"events.index.filepath"`
	Permissions     Permissions `conf:"permissions"`
	Cards           string      `conf:"cards"`
	HMAC            HMAC        `conf:"security.HMAC"`
	Authentication  string      `conf:"security.authentication"`
	HOTP            HOTP        `conf:"security.hotp"`
	RSA             RSA         `conf:"security.rsa"`
	Nonce           Nonce       `conf:"security.nonce"`
	SignOutgoing    bool        `conf:"security.outgoing.sign"`
	EncryptOutgoing bool        `conf:"security.outgoing.encrypt"`

func NewMQTT

func NewMQTT() *MQTT

type Nonce

type Nonce struct {
	Required bool   `conf:"required"`
	Server   string `conf:"server"`
	Clients  string `conf:"clients"`

type OpenAPI

type OpenAPI struct {
	Enabled   bool   `conf:"enabled"`
	Directory string `conf:"directory"`

func NewOpenAPI

func NewOpenAPI() *OpenAPI

type Permissions

type Permissions struct {
	Enabled bool   `conf:"enabled"`
	Users   string `conf:"users"`
	Groups  string `conf:"groups"`

type REST

type REST struct {
	HttpEnabled               bool   `conf:"http.enabled"`
	HttpPort                  uint16 `conf:"http.port"`
	HttpsEnabled              bool   `conf:"https.enabled"`
	HttpsPort                 uint16 `conf:"https.port"`
	TLSKeyFile                string `conf:"tls.key"`
	TLSCertificateFile        string `conf:"tls.certificate"`
	CACertificateFile         string `conf:""`
	RequireClientCertificates bool   `conf:"tls.client.certificates"`
	CORSEnabled               bool   `conf:"CORS.enabled"`
	AuthEnabled               bool   `conf:"auth.enabled"`
	Users                     string `conf:"auth.users"`
	Groups                    string `conf:"auth.groups"`
	HOTP                      HOTP   `conf:"auth.hotp"`

func NewREST

func NewREST() *REST

type RSA

type RSA struct {
	KeyDir string `conf:"keys"`

type System

type System struct {
	BindAddress         *net.UDPAddr  `conf:"bind.address"`
	BroadcastAddress    *net.UDPAddr  `conf:"broadcast.address"`
	ListenAddress       *net.UDPAddr  `conf:"listen.address"`
	Timeout             time.Duration `conf:"timeout"`
	HealthCheckInterval time.Duration `conf:"monitoring.healthcheck.interval"`
	HealthCheckIdle     time.Duration `conf:"monitoring.healthcheck.idle"`
	HealthCheckIgnore   time.Duration `conf:"monitoring.healthcheck.ignore"`
	WatchdogInterval    time.Duration `conf:"monitoring.watchdog.interval"`

type Topics

type Topics struct {
	Root     string `conf:"root"`
	Requests string `conf:"requests"`
	Replies  string `conf:"replies"`
	Events   string `conf:"events"`
	System   string `conf:"system"`

func (*Topics) Resolve

func (t *Topics) Resolve(subtopic string) string

type WildApricot

type WildApricot struct {
	HTTP struct {
		ClientTimeout time.Duration `conf:"client-timeout"`
		Retries       int           `conf:"retries"`
		RetryDelay    time.Duration `conf:"retry-delay"`
	} `conf:"http"`

	Fields struct {
		CardNumber string `conf:"card-number"`
	} `conf:"fields"`

	DisplayOrder struct {
		Groups string `conf:"groups"`
		Doors  string `conf:"doors"`
	} `conf:"display-order"`

	FacilityCode string `conf:"facility-code"`

func NewWildApricot

func NewWildApricot() *WildApricot

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL