Documentation
¶
Overview ¶
Package api provides the HTTP server, middleware, and request handlers.
Index ¶
- Constants
- func AgentWS(state *state.State) http.HandlerFunc
- func EventStream(ctx context.Context, state *state.State) http.HandlerFunc
- func Login(token string) http.HandlerFunc
- func Logout() http.HandlerFunc
- func PublishConfig(state *state.State) http.HandlerFunc
- func PublishEnvs(state *state.State) http.HandlerFunc
- func WithBodyLimit(next http.Handler) http.Handler
- func WithRateLimit(next http.Handler) http.Handler
- func WithSecurityHeaders(next http.Handler) http.Handler
- type Chain
- type Constructor
- type LoginRequest
- type Server
- type UpdateRequest
Constants ¶
const ( // General per-IP rate limit RPS = 30 Burst = 50 // Body size limit MaxBodySize = 1 << 20 )
Variables ¶
This section is empty.
Functions ¶
func AgentWS ¶ added in v0.1.2
func AgentWS(state *state.State) http.HandlerFunc
AgentWS accepts WebSocket connections from agents pushing config updates.
func EventStream ¶
EventStream returns an SSE endpoint that pushes config updates to clients.
func Login ¶
func Login(token string) http.HandlerFunc
Login validates the secret and sets an access cookie.
func PublishConfig ¶
func PublishConfig(state *state.State) http.HandlerFunc
PublishConfig returns the merged traefik config as JSON or YAML.
func PublishEnvs ¶
func PublishEnvs(state *state.State) http.HandlerFunc
PublishEnvs returns a list of registered environment names.
func WithBodyLimit ¶
WithBodyLimit rejects requests larger than MaxBodySize.
func WithRateLimit ¶
WithRateLimit enforces per-IP request limits, cleaning stale entries every minute.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain composes middleware constructors into a pipeline.
func NewChain ¶
func NewChain(constructors ...Constructor) Chain
NewChain returns a Chain that applies each constructor in order.
type Constructor ¶
Constructor wraps middleware that transforms an http.Handler.
type LoginRequest ¶
type LoginRequest struct {
Secret string `json:"secret"`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
type UpdateRequest ¶ added in v0.1.2
type UpdateRequest struct {
Env string `json:"env"`
Name string `json:"name"`
Config json.RawMessage `json:"config"`
}