traefik

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BotMitigationName is the component name for Traefik captcha-protect bot mitigation.
	BotMitigationName = "bot-mitigation"
	// BotMitigationStateOn enables captcha-protect bot mitigation.
	BotMitigationStateOn = "on"
	// BotMitigationStateOff disables captcha-protect bot mitigation.
	BotMitigationStateOff = "off"
)
View Source
const (
	// IngressName is the component name for Traefik ingress settings.
	IngressName = "ingress"

	// IngressModeHTTP serves the stack over plain HTTP.
	IngressModeHTTP = "http"
	// IngressModeHTTPSDefault serves HTTPS using certificates mounted from ./certs.
	IngressModeHTTPSDefault = "https-default"
	// IngressModeHTTPSLetsEncrypt serves HTTPS using Let's Encrypt ACME automation.
	IngressModeHTTPSLetsEncrypt = "https-letsencrypt"

	// DefaultIngressDomain is the default local development domain.
	DefaultIngressDomain = "localhost"
	// DefaultMaxUploadSize is the upload size used when ingress upload settings are not explicitly set.
	DefaultMaxUploadSize = "128M"
	// DefaultUploadTimeout is the read timeout used when ingress upload settings are not explicitly set.
	DefaultUploadTimeout = "300s"
)

Variables

This section is empty.

Functions

func ApplyBotMitigation

func ApplyBotMitigation(projectDir, state string, opts BotMitigationOptions) error

ApplyBotMitigation applies or removes Traefik captcha-protect configuration.

func ApplyBotMitigationContext

func ApplyBotMitigationContext(ctx context.Context, projectDir, state string, opts BotMitigationOptions) error

ApplyBotMitigationContext applies or removes Traefik captcha-protect configuration, using ctx for network work performed while enabling.

func BotMitigation

func BotMitigation(opts BotMitigationOptions) corecomponent.Definition

BotMitigation returns reusable Traefik captcha-protect component metadata.

ApplyBotMitigation is the sole mutating entrypoint. The returned definition is intentionally metadata-only so component review/create prompts cannot drift from the command, volume, router, and plugin-source mutations.

func Ingress added in v0.26.0

Ingress returns a reusable component that owns Traefik ingress, TLS, domain, proxy trust, upload, and read timeout configuration.

Types

type BotMitigationOptions

type BotMitigationOptions struct {
	Name             string
	RouterName       string
	RouterConfigPath string
	MiddlewareName   string
	Middleware       CaptchaProtectMiddlewareOptions
}

BotMitigationOptions configures a reusable Traefik bot-mitigation component for an application router.

func NormalizeBotMitigationOptions

func NormalizeBotMitigationOptions(opts BotMitigationOptions) BotMitigationOptions

NormalizeBotMitigationOptions applies defaults for reusable bot mitigation.

type CaptchaProtectMiddlewareOptions

type CaptchaProtectMiddlewareOptions struct {
	Window                  int
	Mode                    string
	ProtectRoutes           string
	ExcludeRoutes           []string
	ProtectParameters       string
	ChallengeTemplate       string
	ChallengeURL            string
	ChallengeStatusCode     int
	CaptchaProvider         string
	SiteKey                 string
	SecretKey               string
	IPForwardedHeader       string
	GoodBots                []string
	PersistentStateFile     string
	ProtectFileExtensions   string
	PeriodSeconds           int
	FailureThreshold        int
	EnableGooglebotIPCheck  string
	EnableUptimeRobotBypass string
}

CaptchaProtectMiddlewareOptions configures the generated captcha-protect middleware block.

type IngressInspection added in v0.26.0

type IngressInspection struct {
	ComposeFile   string
	Traefik       map[string][]string
	NginxServices map[string]NginxRealIPConfig
}

IngressInspection summarizes Traefik forwarded-header trust and matching nginx real-IP settings.

func InspectIngress added in v0.26.0

func InspectIngress(ctx *config.Context) (IngressInspection, error)

InspectIngress reads the active compose file and extracts ingress trust settings.

type IngressOptions added in v0.26.0

type IngressOptions struct {
	AppService          string
	NoAppService        bool
	TraefikService      string
	HTTPEntrypoint      string
	HTTPSEntrypoint     string
	Entrypoints         []string
	TraefikConfigDir    string
	RouterFiles         []string
	RouterHosts         map[string]string
	ServiceEnvTemplates map[string]map[string]string
	TrustedIPLimit      int
}

IngressOptions configures the reusable Traefik ingress component for a stack.

type NginxRealIPConfig added in v0.22.0

type NginxRealIPConfig struct {
	Service   string
	TrustedIP []string
	Recursive string
}

NginxRealIPConfig describes nginx real-IP environment settings for one service.

Jump to

Keyboard shortcuts

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