app

package
v0.0.0-multi-arch Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package app provides app logic for the opampcommander apiserver.

Index

Constants

View Source
const (
	// DefaultHTTPReadTimeout is the default timeout for reading HTTP requests.
	// It should be set to a reasonable value to avoid security issues.
	DefaultHTTPReadTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func AsController

func AsController(f any) any

AsController is a helper function to annotate a function as a controller.

func NewEngine

func NewEngine(controllers []Controller) *gin.Engine

NewEngine creates a new Gin engine and registers the provided controllers' routes.

func NewEtcdClient

func NewEtcdClient(settings *ServerSettings) (*clientv3.Client, error)

NewEtcdClient creates a new etcd client with the given settings.

func NewHTTPServer

func NewHTTPServer(
	lifecycle fx.Lifecycle,
	engine *gin.Engine,
	settings *ServerSettings,
	logger *slog.Logger,
) *http.Server

NewHTTPServer creates a new HTTP server instance.

func NewLogger

func NewLogger() *slog.Logger

NewLogger creates a new logger instance with default settings.

Types

type Controller

type Controller interface {
	RoutesInfo() gin.RoutesInfo
}

Controller is an interface that defines the methods for handling HTTP requests.

type Server

type Server struct {
	*fx.App
	// contains filtered or unexported fields
}

Server is a struct that represents the server application. It embeds the fx.App struct from the Uber Fx framework.

func NewServer

func NewServer(settings ServerSettings) *Server

NewServer creates a new instance of the Server struct.

type ServerSettings

type ServerSettings struct {
	Addr      string
	EtcdHosts []string
}

ServerSettings is a struct that holds the server settings.

Jump to

Keyboard shortcuts

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