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 ¶
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 ¶
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 ¶
RoutesInstaller is an interface for setting up routes on a gin engine.
type StatsRegistrar ¶
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.
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 ¶
WorkerHandler handles worker WebSocket connections.