services

package
v0.0.0-...-df8f258 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package services provides HTTP and WebSocket server implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMiddleware

type AuthMiddleware interface {
	Handler(ginContext *gin.Context)
}

AuthMiddleware is an interface for authentication middleware.

type ControllerHandler

type ControllerHandler interface {
	HandleControllerV1(c *gin.Context)
	HandleControllerV2(c *gin.Context)
}

ControllerHandler handles controller WebSocket connections.

type ControllerServer

type ControllerServer struct {
	*HTTPServer
	// contains filtered or unexported fields
}

ControllerServer manages the controller server and routing.

func NewControllerServer

func NewControllerServer(ctx context.Context, logger *slog.Logger, config ControllerServerConfig, handler ControllerHandler) (*ControllerServer, error)

NewControllerServer creates a new ControllerServer instance.

func (*ControllerServer) SetupRoutes

func (s *ControllerServer) SetupRoutes(r *gin.Engine) error

SetupRoutes configures all controller routes.

type ControllerServerConfig

type ControllerServerConfig struct {
	Address        string
	Listener       net.Listener
	AuthMiddleware AuthMiddleware
}

ControllerServerConfig holds configuration for the controller server.

type DeviceHandler

type DeviceHandler interface {
	HandleDeviceControl(ginContext *gin.Context)
}

DeviceHandler handles device control WebSocket connections.

type DeviceServer

type DeviceServer struct {
	*HTTPServer
	// contains filtered or unexported fields
}

DeviceServer manages the device server and routing.

func NewDeviceServer

func NewDeviceServer(ctx context.Context, logger *slog.Logger, config DeviceServerConfig) (*DeviceServer, error)

NewDeviceServer creates a new DeviceServer instance.

func (*DeviceServer) SetupRoutes

func (s *DeviceServer) SetupRoutes(r *gin.Engine) error

SetupRoutes configures all device routes.

type DeviceServerConfig

type DeviceServerConfig struct {
	Address        string
	Listener       net.Listener
	AuthMiddleware AuthMiddleware
	DeviceHandler  DeviceHandler
	WorkerHandler  WorkerHandler
}

DeviceServerConfig holds configuration for the device server.

type HTTPServer

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

HTTPServer manages an HTTP server, a base HTTP service that can be emedded or used as a base for any HTTP-based service.

func NewHTTPServer

func NewHTTPServer(ctx context.Context, logger *slog.Logger, config HTTPServerConfig) (*HTTPServer, error)

NewHTTPServer creates a new HTTPServer instance.

func (*HTTPServer) Run

func (s *HTTPServer) Run()

Run runs the HTTP server until Shutdown is called.

func (*HTTPServer) Shutdown

func (s *HTTPServer) Shutdown(ctx context.Context)

Shutdown gracefully shuts down the HTTP server.

type HTTPServerConfig

type HTTPServerConfig struct {
	Address         string
	Listener        net.Listener
	RoutesInstaller RoutesInstaller
	StatsRegistrar  StatsRegistrar
	AuthMiddleware  AuthMiddleware
}

HTTPServerConfig holds configuration for an HTTP server.

type RoutesInstaller

type RoutesInstaller interface {
	SetupRoutes(r *gin.Engine) error
}

RoutesInstaller is an interface for setting up routes on a gin engine.

type StatsRegistrar

type StatsRegistrar interface {
	RegisterGinEngine(r *gin.Engine)
}

StatsRegistrar registers stats collection on a gin engine.

type WebServer

type WebServer struct {
	*HTTPServer
	// contains filtered or unexported fields
}

WebServer manages the HTTP server with API routing and UI serving.

func NewWebServer

func NewWebServer(ctx context.Context, logger *slog.Logger, config WebServerConfig) (*WebServer, error)

NewWebServer creates a new WebServer instance.

func (*WebServer) SetupRoutes

func (s *WebServer) SetupRoutes(r *gin.Engine) error

SetupRoutes configures all HTTP routes.

type WebServerConfig

type WebServerConfig struct {
	Address        string
	Listener       net.Listener
	UIPath         string
	UIFS           *embed.FS
	DevMode        bool
	AuthMiddleware AuthMiddleware
	SetupAPIRoutes func(apiGroup *gin.RouterGroup)
	StatsRegistrar StatsRegistrar
}

WebServerConfig holds configuration for the web server.

type WorkerHandler

type WorkerHandler interface {
	HandleWorker(ginContext *gin.Context)
}

WorkerHandler handles worker WebSocket connections.

Jump to

Keyboard shortcuts

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