traefik/traefik
Data models
The principal Go types in the Traefik codebase, with where they live and what they represent.
Configuration types
| Type | File | Role |
|---|---|---|
static.Configuration |
pkg/config/static/static_config.go |
Top-level static configuration. |
static.EntryPoint |
pkg/config/static/entrypoints.go |
One listener address with TLS / HTTP / HTTP2 / HTTP3 / UDP / ProxyProtocol / ForwardedHeaders settings. |
static.Providers |
pkg/config/static/static_config.go |
Per-provider configuration container. |
dynamic.Configuration |
pkg/config/dynamic/config.go |
Provider-emitted snapshot containing HTTP, TCP, UDP, TLS. |
dynamic.Message |
pkg/config/dynamic/config.go |
{ProviderName, Configuration} envelope used on the watcher channel. |
dynamic.HTTPConfiguration |
pkg/config/dynamic/http_config.go |
Routers, Services, Middlewares, ServersTransports. |
dynamic.Router |
pkg/config/dynamic/http_config.go |
Rule + middlewares + service + TLS. |
dynamic.Service |
pkg/config/dynamic/http_config.go |
Tagged union: LoadBalancer, Weighted, Mirroring, Failover. |
dynamic.Middleware |
pkg/config/dynamic/middlewares.go |
Tagged union: every supported middleware shape. |
dynamic.TCPRouter, dynamic.TCPService |
pkg/config/dynamic/tcp_config.go |
TCP variants. |
dynamic.UDPRouter, dynamic.UDPService |
pkg/config/dynamic/udp_config.go |
UDP variants. |
runtime.Configuration |
pkg/config/runtime/runtime.go |
Dynamic configuration plus per-object Status/Err/Using (the dashboard model). |
Server / runtime types
| Type | File | Role |
|---|---|---|
server.Server |
pkg/server/server.go |
Top-level lifecycle owner. |
server.ConfigurationWatcher |
pkg/server/configurationwatcher.go |
Dispatches dynamic configuration to listeners. |
server.RouterFactory |
pkg/server/routerfactory.go |
Builds the live router tree. |
server.TCPEntryPoints, UDPEntryPoints |
pkg/server/server_entrypoint_*.go |
Listener registries. |
safe.Pool |
pkg/safe/routine.go |
Context-aware goroutine pool. |
tls.Manager |
pkg/tls/tlsmanager.go |
Certificate store + tls.Config factories. |
service.Manager |
pkg/server/service/service.go |
Service-handler factory and health-check coordinator. |
Provider interface
type Provider interface {
Init() error
Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error
}Defined in pkg/provider/provider.go. Every provider in pkg/provider/* implements it.
Middleware factory contract
User-implementable middlewares are typically constructed by:
func New(ctx context.Context, next http.Handler, cfg dynamic.<MiddlewareType>, name string) (http.Handler, error)Optional methods:
type tracingInformer interface {
GetTracingInformation() (name, typeName string, kind trace.SpanKind)
}Implemented by middlewares that want their span to appear in traces.
Load-balancer contract
Each strategy in pkg/server/service/loadbalancer/<strategy> exposes (signature varies by strategy):
type Balancer interface {
AddServer(name string, handler http.Handler, weight int)
RemoveServer(name string)
Servers() []http.Handler
SetStatus(ctx context.Context, name string, up bool)
ServeHTTP(w http.ResponseWriter, r *http.Request)
}SetStatus is the universal method — that's how pkg/healthcheck drains a server.
Health checker
type ServiceHealthChecker struct { ... }
func (c *ServiceHealthChecker) Launch(ctx context.Context)Defined in pkg/healthcheck/healthcheck.go. One per service that has health-checks configured. Updates the load balancer via SetStatus.
TLS types
| Type | File | Role |
|---|---|---|
tls.Options |
pkg/tls/tls.go |
Cipher suites, min/max version, mTLS. |
tls.CertificateStore |
pkg/tls/certificate_store.go |
SNI lookup. |
tls.Certificate |
pkg/tls/certificate.go |
Wraps *tls.Certificate with parsed metadata. |
tls.OCSPConfig |
pkg/tls/ocsp.go |
OCSP stapling configuration. |
ACME types
| Type | File | Role |
|---|---|---|
acme.Provider |
pkg/provider/acme/provider.go |
The ACME provider. |
acme.Account |
pkg/provider/acme/account.go |
Persisted account keypair and registration URL. |
acme.LocalStore |
pkg/provider/acme/local_store.go |
JSON-on-disk certificate store. |
Plugin types
| Type | File | Role |
|---|---|---|
plugins.Manager |
pkg/plugins/manager.go |
Discovery, download, lifecycle. |
plugins.Builder |
pkg/plugins/builder.go |
Bridges manager to middleware factory. |
| Manifest types | pkg/plugins/types.go, plugins.go |
.traefik.yml schema. |
Observability types
| Type | File | Role |
|---|---|---|
metrics.Registry |
pkg/observability/metrics/metrics.go |
Typed metrics interface. |
| Per-backend registries | pkg/observability/metrics/{prometheus,otel,datadog,statsd,influxdb2}.go |
Concrete implementations. |
| Tracer provider | pkg/observability/tracing/tracing.go |
OTel tracer construction. |
logs.Logger(ctx) |
pkg/observability/logs/logs.go |
Context-bound zerolog logger. |
API types
| Type | File | Role |
|---|---|---|
api.Handler |
pkg/api/handler.go |
HTTP routes for the dashboard. |
api.Criterion |
pkg/api/criterion.go |
Pagination / filtering parameters. |
Generated deepcopy
pkg/config/dynamic/zz_generated.deepcopy.go and pkg/tls/zz_generated.deepcopy.go are produced by controller-gen. Don't edit by hand — run make generate-crd after changing any of the listed types.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.