Documentation
¶
Overview ¶
Package server hosts the HTTP API, the OpenAPI spec and the metrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Listen is the TCP address to serve on, e.g. 127.0.0.1:8080.
Listen string
// Version is reported by the health endpoint.
Version string
// FetchUserHeader names the request header that says who fetched the
// list, such as one an authenticating proxy sets, for the fetch metric.
FetchUserHeader string
// FetchAddressHeader names the request header holding the client's
// address, set by the proxy in front; empty records no addresses.
FetchAddressHeader string
// TrustedProxies are the peers whose fetch headers are believed; empty
// believes every peer.
TrustedProxies []netip.Prefix
}
Config holds what the server needs to start.
type Lists ¶
type Lists interface {
Current() *publish.Current
LastSuccess() time.Time
// Seen is told who fetched the list, and from where.
Seen(user, address string)
}
Lists is where the served list comes from.
type Metrics ¶
type Metrics interface {
Counter(name, help string)
Add(name string, v float64, labels ...string)
Write(w io.Writer) error
}
Metrics is the registry the server counts fetches in and serves.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves /api/v1, the OpenAPI spec and /metrics on one listener.
func (*Server) Handler ¶
Handler returns the served handler (the route table behind the access log), for tests.