server

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package server manages HTTP/HTTPS listener lifecycle and hot reload.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalancerStatus

type BalancerStatus struct {
	Service    string   `json:"service"`
	RouteIndex int      `json:"route_index"`
	Type       string   `json:"type"`
	Action     string   `json:"action"`
	Targets    []string `json:"targets"`
}

BalancerStatus describes a route's balancer state for external inspection.

type Group

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

Group manages multiple HTTP servers, one per configured service.

func Build

func Build(cfg *config.Config, configDir string) (*Group, error)

Build creates a server group from the loaded configuration. configDir is the directory containing the config file, used for resolving relative paths (e.g., ACME certificate storage).

func (*Group) BalancerInfo

func (g *Group) BalancerInfo() []BalancerStatus

BalancerInfo returns the current state of all balancers.

func (*Group) CertificateStatus

func (g *Group) CertificateStatus() []proxacme.CertStatus

CertificateStatus returns certificate status across all ACME-enabled services.

func (*Group) CurrentConfig

func (g *Group) CurrentConfig() *config.Config

CurrentConfig returns the active configuration.

func (*Group) ListenAndServe

func (g *Group) ListenAndServe(ctx context.Context) error

ListenAndServe starts all servers and blocks until ctx is cancelled.

func (*Group) PluginNames

func (g *Group) PluginNames() []PluginStatus

PluginNames returns the names and paths of all configured plugins.

func (*Group) Reload

func (g *Group) Reload(cfg *config.Config) error

Reload atomically swaps the routing logic for all services. Listeners keep running — zero downtime. If the new config changes listen addresses or adds/removes services, those changes require a full restart.

func (*Group) RouteCount

func (g *Group) RouteCount() int

RouteCount returns the total number of routes across all services.

func (*Group) ServiceInfo

func (g *Group) ServiceInfo() []ServiceStatus

ServiceInfo returns metadata about each configured service.

type PluginStatus

type PluginStatus struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

PluginStatus describes a configured plugin for external inspection.

type ServiceStatus

type ServiceStatus struct {
	Name   string `json:"name"`
	Listen string `json:"listen"`
	TLS    bool   `json:"tls"`
	ACME   bool   `json:"acme"`
	Routes int    `json:"routes"`
}

ServiceStatus describes a running service for external inspection.

Jump to

Keyboard shortcuts

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