traefik

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingService  = fmt.Errorf("traefik service not set")
	ErrDuplicateRouter = fmt.Errorf("duplicate router name")
	ErrBacktickInRule  = fmt.Errorf("backtick in router rule value")
)

Functions

This section is empty.

Types

type FileExporter

type FileExporter struct {
	// contains filtered or unexported fields
}

func NewFileExporter

func NewFileExporter(opts ...Option) *FileExporter

NewFileExporter creates an exporter that writes the defined routes as a Traefik v3 dynamic configuration file, one router per route. Internal routes are left out.

func (*FileExporter) Export

func (e *FileExporter) Export(set route.Set) error

type Option

type Option func(*FileExporter)

func WithCertResolver

func WithCertResolver(resolver string) Option

WithCertResolver enables TLS on every router using the given cert resolver.

func WithDefaultMiddlewares

func WithDefaultMiddlewares(middlewares ...string) Option

WithDefaultMiddlewares sets Traefik middlewares applied to every router, before any policy middlewares.

func WithEntryPoints

func WithEntryPoints(entryPoints ...string) Option

WithEntryPoints sets the Traefik entry points every router listens on. Without it routers listen on all of Traefik's default entry points.

func WithHost

func WithHost(host string) Option

WithHost adds a Host matcher to every router rule.

func WithOutputFile

func WithOutputFile(path string) Option

WithOutputFile sets the file the dynamic configuration is written to. Without it the exporter does nothing.

func WithPolicyMiddlewares

func WithPolicyMiddlewares(policy string, middlewares ...string) Option

WithPolicyMiddlewares maps a policy registered on the HTTP module to Traefik middlewares, added to the router of every route that applies the policy.

func WithRouterPrefix

func WithRouterPrefix(prefix string) Option

WithRouterPrefix prefixes every router name, e.g. with the service name, to keep names unique across services sharing one Traefik instance. The prefix is lowercased and characters other than a-z, 0-9, '_' and '-' become '-'.

func WithService

func WithService(service string) Option

WithService sets the Traefik service every router forwards to.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL