server

package
v0.0.0-...-e05b1bb Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const DevVersion = "0.0.0"
View Source
const SocketPath = "/tmp/evcm"

SocketPath is the unix domain socket path

Variables

View Source
var (
	// Version of executable
	Version = DevVersion

	// Commit of executable
	Commit = ""
)

Functions

func FormattedVersion

func FormattedVersion() string

func HealthListener

func HealthListener(site site.API)

HealthListener attaches listener to unix domain socket and runs listener

Types

type HTTPd

type HTTPd struct {
	*http.Server
}

HTTPd wraps an http.Server and adds the root router

func NewHTTPd

func NewHTTPd(addr string, hub *SocketHub) *HTTPd

NewHTTPd creates HTTP server with configured routes for loadpoint

func (*HTTPd) RegisterShutdownHandler

func (s *HTTPd) RegisterShutdownHandler(callback func())

RegisterShutdownHandler connects the http handlers to the site

func (*HTTPd) RegisterSiteHandlers

func (s *HTTPd) RegisterSiteHandlers(site site.API, cache *util.Cache)

RegisterSiteHandlers connects the http handlers to the site

func (*HTTPd) Router

func (s *HTTPd) Router() *mux.Router

Router returns the main router

type Influx

type Influx struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Influx is a influx publisher

func NewInfluxClient

func NewInfluxClient(url, token, org, user, password, database string) *Influx

NewInfluxClient creates new publisher for influx

func (*Influx) Run

func (m *Influx) Run(site site.API, in <-chan util.Param)

Run Influx publisher

type InfluxConfig

type InfluxConfig struct {
	URL      string
	Database string
	Token    string
	Org      string
	User     string
	Password string
	Interval time.Duration
}

InfluxConfig is the influx db configuration

type MQTT

type MQTT struct {
	Handler *mqtt.Client
	// contains filtered or unexported fields
}

MQTT is the MQTT server. It uses the MQTT client for publishing.

func NewMQTT

func NewMQTT(root string) *MQTT

NewMQTT creates MQTT server

func (*MQTT) Run

func (m *MQTT) Run(site site.API, in <-chan util.Param)

Run starts the MQTT publisher for the MQTT API

type SocketHub

type SocketHub struct {
	// contains filtered or unexported fields
}

SocketHub maintains the set of active clients and broadcasts messages to the clients.

func NewSocketHub

func NewSocketHub() *SocketHub

NewSocketHub creates a web socket hub that distributes meter status and query results for the ui or other clients

func (*SocketHub) Run

func (h *SocketHub) Run(in <-chan util.Param, cache *util.Cache)

Run starts data and status distribution

func (*SocketHub) ServeWebsocket

func (h *SocketHub) ServeWebsocket(w http.ResponseWriter, r *http.Request)

ServeWebsocket handles websocket requests from the peer.

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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