Documentation
¶
Index ¶
- func DestroySessionRoutes(sessionName string, routes map[string]string) error
- func GetServiceMapping(portName string) string
- func NormalizeDNSName(serviceName string) string
- func ProvisionSessionRoutes(sessionName string, services map[string]int) (map[string]string, error)
- func ProvisionSessionRoutesWithProject(sessionName string, services map[string]int, projectAlias string) (map[string]string, error)
- func RepairRoutes(result *HealthCheckResult, sessions map[string]*SessionInfo) error
- func SanitizeHostname(sessionName string) string
- type CaddyClient
- func (c *CaddyClient) CheckCaddyConnection() error
- func (c *CaddyClient) CreateRoute(sessionName, serviceName string, port int) (string, error)
- func (c *CaddyClient) CreateRouteWithProject(sessionName, serviceName string, port int, projectAlias string) (string, error)
- func (c *CaddyClient) DeleteRoute(routeID string) error
- func (c *CaddyClient) DeleteSessionRoutes(sessionName string) error
- func (c *CaddyClient) GetAllRoutes() ([]Route, error)
- func (c *CaddyClient) ReplaceAllRoutes(routes []Route) error
- type HealthCheckResult
- type Route
- type RouteHandler
- type RouteMatch
- type RouteResponse
- type RouteStatus
- type RouteUpstream
- type SessionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DestroySessionRoutes ¶
DestroySessionRoutes removes all Caddy routes for a session
func GetServiceMapping ¶
GetServiceMapping maps port environment variable names to service names
func NormalizeDNSName ¶
NormalizeDNSName converts a service name to be DNS-compatible
func ProvisionSessionRoutes ¶
ProvisionSessionRoutes creates Caddy routes for all services in a session
func ProvisionSessionRoutesWithProject ¶
func ProvisionSessionRoutesWithProject(sessionName string, services map[string]int, projectAlias string) (map[string]string, error)
ProvisionSessionRoutesWithProject creates Caddy routes for all services in a session with optional project prefix
func RepairRoutes ¶
func RepairRoutes(result *HealthCheckResult, sessions map[string]*SessionInfo) error
RepairRoutes attempts to fix any routing issues found during health check
func SanitizeHostname ¶
SanitizeHostname converts a session name to be hostname-compatible
Types ¶
type CaddyClient ¶
type CaddyClient struct {
// contains filtered or unexported fields
}
CaddyClient manages communication with Caddy's admin API
func NewCaddyClient ¶
func NewCaddyClient() *CaddyClient
NewCaddyClient creates a new Caddy API client
func (*CaddyClient) CheckCaddyConnection ¶
func (c *CaddyClient) CheckCaddyConnection() error
CheckCaddyConnection verifies that Caddy is running and accessible
func (*CaddyClient) CreateRoute ¶
func (c *CaddyClient) CreateRoute(sessionName, serviceName string, port int) (string, error)
CreateRoute creates a route for a service
func (*CaddyClient) CreateRouteWithProject ¶
func (c *CaddyClient) CreateRouteWithProject(sessionName, serviceName string, port int, projectAlias string) (string, error)
CreateRouteWithProject creates a route for a service with optional project prefix
func (*CaddyClient) DeleteRoute ¶
func (c *CaddyClient) DeleteRoute(routeID string) error
DeleteRoute deletes a route by ID
func (*CaddyClient) DeleteSessionRoutes ¶
func (c *CaddyClient) DeleteSessionRoutes(sessionName string) error
DeleteSessionRoutes deletes all routes for a session
func (*CaddyClient) GetAllRoutes ¶
func (c *CaddyClient) GetAllRoutes() ([]Route, error)
GetAllRoutes retrieves all routes from Caddy
func (*CaddyClient) ReplaceAllRoutes ¶
func (c *CaddyClient) ReplaceAllRoutes(routes []Route) error
ReplaceAllRoutes deletes all current routes and creates new ones in the specified order
type HealthCheckResult ¶
type HealthCheckResult struct {
CaddyRunning bool
CaddyError string
RouteStatuses []RouteStatus
CatchAllFirst bool // Whether catch-all route is blocking specific routes
RoutesNeeded int
RoutesExisting int
RoutesWorking int
}
HealthCheckResult contains the overall Caddy health status
func CheckCaddyHealth ¶
func CheckCaddyHealth(sessions map[string]*SessionInfo) (*HealthCheckResult, error)
CheckCaddyHealth performs a comprehensive health check of Caddy and all routes
type Route ¶
type Route struct {
ID string `json:"@id"`
Match []RouteMatch `json:"match"`
Handle []RouteHandler `json:"handle"`
Terminal bool `json:"terminal"`
}
Route represents a Caddy route configuration
type RouteHandler ¶
type RouteHandler struct {
Handler string `json:"handler"`
Upstreams []RouteUpstream `json:"upstreams,omitempty"`
}
RouteHandler represents a route handler
type RouteMatch ¶
type RouteMatch struct {
Host []string `json:"host"`
}
RouteMatch represents the match criteria for a route
type RouteResponse ¶
type RouteResponse struct {
ETag string `json:"etag,omitempty"`
}
RouteResponse represents the response from Caddy when creating/updating routes
type RouteStatus ¶
type RouteStatus struct {
SessionName string
ServiceName string
RouteID string
Hostname string
Port int
Exists bool
IsFirst bool // Whether route appears before catch-all
ServiceUp bool // Whether the service is responding
Error string
}
RouteStatus represents the status of a Caddy route
type RouteUpstream ¶
type RouteUpstream struct {
Dial string `json:"dial"`
}
RouteUpstream represents an upstream server