server

package
v0.0.0-...-e05d22d Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerFlagHotReloadWWW = 1 // Don't embed the 'www' directory into our binary, but load it from disk, and assume it's not immutable. This is for dev time on the 'www' source.
)

Variables

This section is empty.

Functions

func StartVPN

func StartVPN(log logs.Log, privateKey wgtypes.Key, kernelWGSecret string, forceIPv4 bool) (*vpn.VPN, error)

Start a VPN client

Types

type ProtectedHandler

type ProtectedHandler func(w http.ResponseWriter, r *http.Request, params httprouter.Params, user *configdb.User)

type Server

type Server struct {
	Log              logs.Log
	TempFiles        *util.TempFiles
	RingBufferSize   int            // Size of the circular buffer for each camera
	MustRestart      bool           // Value of the 'restart' parameter to Shutdown()
	ShutdownStarted  chan bool      // This channel is closed when shutdown starts. So you can select() on it, to wait for shutdown.
	ShutdownComplete chan error     // Used by main() to report any shutdown errors
	OwnIP            net.IP         // If not nil, overrides the IP address used when scanning the LAN for cameras
	HotReloadWWW     bool           // Don't embed the 'www' directory into our binary, but load it from disk, and assume it's not immutable. This is for dev time on the 'www' source.
	StartupErrors    []StartupError // Critical errors encountered at startup. Note that these are errors that are resolvable by fixing the config through the App UI.

	// Public Subsystems
	LiveCameras *livecameras.LiveCameras
	// contains filtered or unexported fields
}

func NewServer

func NewServer(logger logs.Log, cfg *configdb.ConfigDB, serverFlags int, nnModelsDir, nnModelName string) (*Server, error)

Create a new server, load config, start cameras, and listen on HTTP

func (*Server) ApplyConfig

func (s *Server) ApplyConfig()

This is called whenever system config changes

func (*Server) ListenForKillSignals

func (s *Server) ListenForKillSignals()

func (*Server) ListenHTTP

func (s *Server) ListenHTTP(port string) error

port example: ":8080"

func (*Server) ListenHTTPS

func (s *Server) ListenHTTPS(sslCertDirectory string, privilegeLimiter *wgroot.PrivilegeLimiter) error

func (*Server) SetTempFilePath

func (s *Server) SetTempFilePath(tempFilePath string) error

We don't want temp files to be on the videos dir, because the videos are likely to be stored on a USB flash drive, and this could cause the temp file to get written to disk, when we don't actually want that. We just want it as swap space... i.e. only written to disk if we run out of RAM.

func (*Server) SetupHTTP

func (s *Server) SetupHTTP() error

func (*Server) Shutdown

func (s *Server) Shutdown(restart bool)

func (*Server) StartVideoDB

func (s *Server) StartVideoDB() error

type StartupError

type StartupError struct {
	Code    StartupErrorCode `json:"code"`
	Message string           `json:"message"` // Possibly detailed message. We never want to throw an error message away, in case there is only one critical code path that elicits it.
}

SYNC-STARTUP-ERROR

type StartupErrorCode

type StartupErrorCode string

These are critical errors that prevent the system from functioning. The idea is that these errors appear on first run, and then you configure the system correctly, and once you've restarted the system and everything is good, then these errors drop to zero

const (
	// SYNC-STARTUP-ERROR-CODES
	StartupErrorArchivePath StartupErrorCode = "ARCHIVE_PATH" // Could be unconfigured or invalid. The front-end can figure that out by taking the user to the config page.
)

Directories

Path Synopsis
Package perfstats is a single place where we record the performance of various operations, so that it's easy to compare different solutions and the performance of different hardware.
Package perfstats is a single place where we record the performance of various operations, so that it's easy to compare different solutions and the performance of different hardware.

Jump to

Keyboard shortcuts

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