Documentation
¶
Overview ¶
Package router is Skiff's edge router: it discovers apps from Docker labels and reverse-proxies <app>.<domain> to them, with automatic HTTPS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
T int64 `json:"t"` // minute, unix seconds (floored)
Req int `json:"req"`
S2 int `json:"s2"`
S3 int `json:"s3"`
S4 int `json:"s4"`
S5 int `json:"s5"`
LatMs int64 `json:"lat"` // summed latency in ms (÷ Req for the average)
BytesI int64 `json:"bi"` // request bytes in
BytesO int64 `json:"bo"` // response bytes out
}
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
type ReqEntry ¶ added in v0.2.0
type ReqEntry struct {
T int64 `json:"t"` // unix millis
A string `json:"a"` // app
M string `json:"m"`
P string `json:"p"` // path, no query string
S int `json:"s"`
D int64 `json:"d"` // duration ms
B int64 `json:"b"` // response bytes
R string `json:"r,omitempty"` // referring host, when it's another site
V string `json:"v"` // visitor: keyed hash of ip+user agent, rotating daily
Bt bool `json:"bt,omitempty"`
}
ReqEntry is one proxied request, as appended to <dir>/<YYYY-MM-DD>.jsonl.
type ReqLog ¶ added in v0.2.0
type ReqLog struct {
// contains filtered or unexported fields
}
ReqLog appends request entries from a buffered channel so the proxy path never waits on disk; when the buffer is full, entries are dropped.
type Router ¶
type Router struct {
Domains []string
Engine *docker.Engine
Panel string // fallback host:port of the control panel; dash.<domain> proxies here
// PanelPointer, when set, is a file the panel rewrites during a zero-downtime self-deploy to flip dash.<domain> onto the new process without restarting the router.
PanelPointer string
SiteApp string // app that serves the apex + www.<domain>
// DomainsFile, when set, is a JSON file of custom host→app mappings read live (cached briefly) so domains change without restarting the edge.
DomainsFile string
// MetricsFile, when set, is where the router snapshots per-app request metrics for the panel's Analytics page.
MetricsFile string
// RequestsDir, when set, receives a daily JSONL log of each request to an app, which the panel reads for per-project insights.
RequestsDir string
// SleepFile lists apps the panel stopped for being idle; a visit to one starts it again.
SleepFile string
// MailFile is the JSON forwarding table (domain → alias → destinations) read live by the SMTP listener on SMTPAddr.
MailFile string
SMTPAddr string
// contains filtered or unexported fields
}