Documentation
¶
Overview ¶
Package proxy is Zelie's web front door. It terminates HTTPS, gets certificates automatically, and forwards each domain to the container that serves it. It runs as its own unprivileged process so the panel can restart or update without dropping a single site.
Index ¶
Constants ¶
const ( TLSACME = "acme" // certificates from Let's Encrypt TLSSelfSigned = "self-signed" // for machines no certificate authority can reach // TLSTunnel is for a proxy behind a Cloudflare Tunnel: Cloudflare holds // the certificates, and the proxy serves plain HTTP on a loopback port // that only the tunnel's connector reaches. TLSTunnel = "tunnel" )
TLS modes.
Variables ¶
This section is empty.
Functions ¶
func ValidDomain ¶
ValidDomain reports whether h, in lower case, is a domain name the proxy can route.
Types ¶
type Addrs ¶
type Addrs struct {
HTTP string // e.g. ":80"
HTTPS string // e.g. ":443"; empty behind a tunnel
Socket string // control socket for the panel
}
Addrs says where the proxy listens.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client changes the proxy's configuration over its control socket.
type Config ¶
type Config struct {
TLS string `json:"tls"`
Email string `json:"email,omitempty"` // for the certificate authority
Panel string `json:"panel,omitempty"` // host name the panel answers on
Routes []Route `json:"routes"`
}
Config is everything the proxy serves. It is always replaced as a whole.
type Counts ¶ added in v0.5.0
type Counts struct {
Requests uint64 `json:"requests"`
// ClientErrors are 4xx answers; ServerErrors are 5xx, including the
// 502 the proxy gives when the app does not answer.
ClientErrors uint64 `json:"client_errors"`
ServerErrors uint64 `json:"server_errors"`
}
Counts are the requests one host has had since the proxy started.
type Proxy ¶
type Proxy struct {
StateDir string
PanelSocket string // Unix socket the panel listens on
Log *slog.Logger
// contains filtered or unexported fields
}
Proxy serves the configured routes. Apply swaps in a new configuration without dropping open connections.
func (*Proxy) Load ¶
Load applies the configuration saved by the last Apply, so the proxy can start serving on its own after a reboot, before the panel is up.