Documentation
¶
Overview ¶
Package proxy provides types and handlers for managing reverse proxy applications. It defines the core interfaces and configuration for reverse proxying, with concrete runtime integration (currently using Caddy, see https://github.com/caddyserver/caddy) implemented in the internal/proxy package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Domain string `json:"domain"`
Upstream string `json:"upstream"`
Root string `json:"root,omitempty"`
Template TemplateType `json:"template"` // static, reverse_proxy, or php_fastcgi
}
type HandleProxy ¶
type HandleProxy interface {
// Setup generates a Caddyfile from templates and persists app configuration state.
// It creates the config directory if needed and saves all apps to apps.json for
// later modification operations.
Setup(apps map[string]App) error
// Status returns the current status of the proxy service
Status() ProxyStatusResponse
// Restart reloads Caddy with the current Caddyfile configuration.
Restart() error
// Add merges new apps with existing configuration, regenerates the Caddyfile,
// and reloads Caddy. Duplicate domains are replaced with new configurations.
Add(apps map[string]App) error
// Remove deletes apps by domain, regenerates the Caddyfile, and reloads Caddy.
Remove(domains []string) error
}
type Proxier ¶
type Proxier struct {
// contains filtered or unexported fields
}
func NewProxier ¶
func NewProxier(a map[string]App, p HandleProxy) *Proxier
type ProxyHandler ¶
type ProxyHandler struct {
// contains filtered or unexported fields
}
func NewProxyHandler ¶
func NewProxyHandler(p *Proxier, l *shared.Logger) *ProxyHandler
func (*ProxyHandler) GetStatus ¶
func (h *ProxyHandler) GetStatus(w http.ResponseWriter, r *http.Request)
func (*ProxyHandler) HandleAdd ¶
func (h *ProxyHandler) HandleAdd(w http.ResponseWriter, r *http.Request)
func (*ProxyHandler) HandleRemove ¶
func (h *ProxyHandler) HandleRemove(w http.ResponseWriter, r *http.Request)
func (*ProxyHandler) HandleRestart ¶
func (h *ProxyHandler) HandleRestart(w http.ResponseWriter, r *http.Request)
type ProxyRoute ¶
type ProxyStatus ¶
type ProxyStatus struct {
Status string `json:"status"`
}
type ProxyStatusResponse ¶
type TemplateType ¶
type TemplateType string
const ( TemplateStatic TemplateType = "static" TemplateReverseProxy TemplateType = "reverse_proxy" TemplatePHPFastCGI TemplateType = "php_fastcgi" )
Click to show internal directories.
Click to hide internal directories.