Documentation
¶
Index ¶
- func Compile(cfg *Config) (Compiled, ValidationResult)
- func Format(cfg *Config) ([]byte, error)
- func FormatDiff(oldData, newData []byte, contextLines int, oldName, newName string) (string, error)
- func FormatValidationJSON(res ValidationResult) (string, error)
- func FormatValidationText(res ValidationResult) string
- func IsValidManagementLabel(raw string) bool
- func ManagementLabelPattern() string
- func NormalizedDiffLines(s string) []string
- func UnifiedDiff(ops []DiffOp, contextLines int, oldName, newName string) string
- func Validate(cfg *Config) error
- type APIBlock
- type APIConfig
- type AccessLogBlock
- type BasicAuth
- type ChannelType
- type Compiled
- type CompiledDeliver
- type CompiledRoute
- type Config
- type DLQRetentionBlock
- type DLQRetentionConfig
- type DefaultsBlock
- type DefaultsConfig
- type Deliver
- type DeliverBlock
- type DeliverSigningHMACConfig
- type DeliverSigningSecretVersion
- type DeliveredRetentionBlock
- type DeliveredRetentionConfig
- type DiffOp
- type EgressBlock
- type EgressPolicyConfig
- type EgressRule
- type ForwardAuthBlock
- type ForwardAuthConfig
- type HeaderMatch
- type HeaderMatchConfig
- type IngressBlock
- type IngressConfig
- type MatchBlock
- type MatchConfig
- type MetricsBlock
- type MetricsConfig
- type NamedMatcher
- type ObservabilityBlock
- type ObservabilityConfig
- type PublishBlock
- type PublishPolicyBlock
- type PublishPolicyConfig
- type Pull
- type PullConfig
- type QueryMatch
- type QueryMatchConfig
- type QueueBlock
- type QueueLimitsBlock
- type QueueLimitsConfig
- type QueueRetentionBlock
- type QueueRetentionConfig
- type RateLimitBlock
- type RateLimitConfig
- type RetryBlock
- type RetryConfig
- type Route
- type RuntimeLogBlock
- type SecretBlock
- type SecretConfig
- type SecretsBlock
- type TLSBlock
- type TLSConfig
- type TracingBlock
- type TracingHeader
- type TracingHeaderConfig
- type TracingRetryBlock
- type TracingRetryConfig
- type TracingTLSBlock
- type TrendSignalsBlock
- type TrendSignalsConfig
- type ValidationResult
- type VarItem
- type VarsBlock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compile ¶
func Compile(cfg *Config) (Compiled, ValidationResult)
Compile validates the config and returns a runtime-ready, normalized version with defaults applied.
func Format ¶
Format returns a deterministic representation of the parsed config.
The formatter does not expand defaults; it formats only what is present in the input file.
func FormatDiff ¶
FormatDiff parses two config byte slices, formats them canonically, and returns a unified diff. contextLines defaults to 3 if <= 0.
func FormatValidationJSON ¶
func FormatValidationJSON(res ValidationResult) (string, error)
func FormatValidationText ¶
func FormatValidationText(res ValidationResult) string
func IsValidManagementLabel ¶
func ManagementLabelPattern ¶
func ManagementLabelPattern() string
func NormalizedDiffLines ¶
NormalizedDiffLines splits text into lines, normalizing CRLF to LF and stripping a final empty element caused by a trailing newline.
func UnifiedDiff ¶
UnifiedDiff formats a sequence of DiffOp values as a unified diff string with the given number of context lines. Returns "" when there are no changes.
Types ¶
type APIBlock ¶
type APIBlock struct {
Listen string
ListenQuoted bool
Prefix string
PrefixQuoted bool
TLS *TLSBlock
// AuthTokens holds token references for Pull/Admin API auth.
// For now, only Pull API tokens are used by the runtime.
AuthTokens []string
AuthTokensQuoted []bool
MaxBatch string
MaxBatchQuoted bool
MaxBatchSet bool
DefaultLeaseTTL string
DefaultLeaseTTLQuoted bool
DefaultLeaseTTLSet bool
MaxLeaseTTL string
MaxLeaseTTLQuoted bool
MaxLeaseTTLSet bool
DefaultMaxWait string
DefaultMaxWaitQuoted bool
DefaultMaxWaitSet bool
MaxWait string
MaxWaitQuoted bool
MaxWaitSet bool
}
type AccessLogBlock ¶
type ChannelType ¶
type ChannelType string
ChannelType determines which directives are allowed on a route.
const ( // ChannelDefault is the zero value — bare top-level routes (implicit inbound). ChannelDefault ChannelType = "" ChannelInbound ChannelType = "inbound" ChannelOutbound ChannelType = "outbound" ChannelInternal ChannelType = "internal" )
type Compiled ¶
type Compiled struct {
Ingress IngressConfig
Defaults DefaultsConfig
Vars map[string]string
Secrets map[string]SecretConfig
PullAPI APIConfig
AdminAPI APIConfig
Observability ObservabilityConfig
QueueRetention QueueRetentionConfig
DeliveredRetention DeliveredRetentionConfig
DLQRetention DLQRetentionConfig
QueueLimits QueueLimitsConfig
HasPullRoutes bool
HasDeliverRoutes bool
// Routes are in evaluation order (top-down).
Routes []CompiledRoute
// PathToRoute maps Pull paths (relative to PullAPI.Prefix) to route paths.
PathToRoute map[string]string
}
type CompiledDeliver ¶
type CompiledDeliver struct {
URL string
Timeout time.Duration
Retry RetryConfig
SigningHMAC DeliverSigningHMACConfig
}
type CompiledRoute ¶
type CompiledRoute struct {
ChannelType ChannelType
Path string
Pull *PullConfig
Application string
EndpointName string
Publish bool
PublishDirect bool
PublishManaged bool
Match MatchConfig
RateLimit RateLimitConfig
AuthBasic map[string]string
AuthForward ForwardAuthConfig
AuthHMACSecrets []string
AuthHMACSecretRefs []string
AuthHMACSignatureHeader string
AuthHMACTimestampHeader string
AuthHMACNonceHeader string
AuthHMACTolerance time.Duration
QueueBackend string
MaxBodyBytes int64
MaxHeaderBytes int
DeliverConcurrency int
Deliveries []CompiledDeliver
}
type Config ¶
type Config struct {
// Preamble holds leading comment lines (including the leading '#').
// It is preserved by `config fmt` to avoid losing file headers.
Preamble []string
Ingress *IngressBlock
Defaults *DefaultsBlock
Vars *VarsBlock
Secrets *SecretsBlock
PullAPI *APIBlock
AdminAPI *APIBlock
Observability *ObservabilityBlock
QueueRetention *QueueRetentionBlock
DeliveredRetention *DeliveredRetentionBlock
DLQRetention *DLQRetentionBlock
QueueLimits *QueueLimitsBlock
NamedMatchers []NamedMatcher
// Routes are evaluated top-down (first match wins).
Routes []Route
}
Config is the parsed, user-authored configuration file.
It intentionally keeps optional blocks as pointers so we can distinguish between "not set" (use defaults) and "set but empty" (usually invalid).
type DLQRetentionBlock ¶
type DLQRetentionConfig ¶
type DefaultsBlock ¶
type DefaultsBlock struct {
MaxBody string
MaxBodyQuoted bool
MaxBodySet bool
MaxHeaders string
MaxHeadersQuoted bool
MaxHeadersSet bool
Egress *EgressBlock
PublishPolicy *PublishPolicyBlock
Deliver *DeliverBlock
TrendSignals *TrendSignalsBlock
}
type DefaultsConfig ¶
type DefaultsConfig struct {
MaxBodyBytes int64
MaxHeaderBytes int
DeliverRetry RetryConfig
DeliverTimeout time.Duration
DeliverConcurrency int
TrendSignals TrendSignalsConfig
EgressPolicy EgressPolicyConfig
PublishPolicy PublishPolicyConfig
}
type Deliver ¶
type Deliver struct {
URL string
URLQuoted bool
Retry *RetryBlock
Timeout string
TimeoutQuoted bool
TimeoutSet bool
SignHMACSecret string
SignHMACSecretQuoted bool
SignHMACSecretSet bool
SignHMACSecretRefs []string
SignHMACSecretRefsQuoted []bool
SignHMACSignatureHeader string
SignHMACSignatureHeaderQuoted bool
SignHMACSignatureHeaderSet bool
SignHMACTimestampHeader string
SignHMACTimestampHeaderQuoted bool
SignHMACTimestampHeaderSet bool
SignHMACSecretSelection string
SignHMACSecretSelectionQuoted bool
SignHMACSecretSelectionSet bool
}
type DeliverBlock ¶
type DeliveredRetentionBlock ¶
type DiffOp ¶
DiffOp represents a single line-level diff operation.
func LineDiffOps ¶
LineDiffOps computes a line-level diff using the LCS algorithm and returns a sequence of DiffOp values annotated with 1-based line numbers.
type EgressBlock ¶
type EgressPolicyConfig ¶
type EgressPolicyConfig struct {
HTTPSOnly bool
Redirects bool
DNSRebindProtection bool
Allow []EgressRule
Deny []EgressRule
}
type EgressRule ¶
type ForwardAuthBlock ¶
type ForwardAuthConfig ¶
type HeaderMatch ¶
type HeaderMatchConfig ¶
type IngressBlock ¶
type IngressBlock struct {
Listen string
ListenQuoted bool
TLS *TLSBlock
RateLimit *RateLimitBlock
}
type IngressConfig ¶
type IngressConfig struct {
Listen string
TLS TLSConfig
RateLimit RateLimitConfig
}
type MatchBlock ¶
type MatchConfig ¶
type MatchConfig struct {
Methods []string
Hosts []string
Headers []HeaderMatchConfig
Query []QueryMatchConfig
RemoteIPs []netip.Prefix
HeaderExists []string
QueryExists []string
}
type MetricsBlock ¶
type MetricsConfig ¶
type NamedMatcher ¶
type NamedMatcher struct {
Name string
Match *MatchBlock
}
type ObservabilityBlock ¶
type ObservabilityBlock struct {
AccessLog string
AccessLogQuoted bool
AccessLogSet bool
AccessLogBlock *AccessLogBlock
RuntimeLog string
RuntimeLogQuoted bool
RuntimeLogSet bool
RuntimeLogBlock *RuntimeLogBlock
Metrics *MetricsBlock
Tracing *TracingBlock
}
type ObservabilityConfig ¶
type ObservabilityConfig struct {
AccessLogEnabled bool
AccessLogOutput string
AccessLogPath string
RuntimeLogLevel string
RuntimeLogDisabled bool
RuntimeLogOutput string
RuntimeLogPath string
RuntimeLogSet bool
Metrics MetricsConfig
TracingEnabled bool
TracingCollector string
TracingURLPath string
TracingCompression string
TracingInsecure bool
TracingTimeout time.Duration
TracingTimeoutSet bool
TracingProxyURL string
TracingTLSCAFile string
TracingTLSCertFile string
TracingTLSKeyFile string
TracingTLSServerName string
TracingTLSInsecureSkipVerify bool
TracingRetry *TracingRetryConfig
TracingHeaders []TracingHeaderConfig
}
type PublishBlock ¶
type PublishPolicyBlock ¶
type PublishPolicyBlock struct {
Direct string
DirectQuoted bool
DirectSet bool
Managed string
ManagedQuoted bool
ManagedSet bool
AllowPullRoutes string
AllowPullRoutesQuoted bool
AllowPullRoutesSet bool
AllowDeliverRoutes string
AllowDeliverRoutesQuoted bool
AllowDeliverRoutesSet bool
RequireActor string
RequireActorQuoted bool
RequireActorSet bool
RequireRequestID string
RequireRequestIDQuoted bool
RequireRequestIDSet bool
FailClosed string
FailClosedQuoted bool
FailClosedSet bool
ActorAllow []string
ActorAllowQuoted []bool
ActorPrefix []string
ActorPrefixQuoted []bool
}
type PublishPolicyConfig ¶
type PullConfig ¶
type QueryMatch ¶
type QueryMatchConfig ¶
type QueueBlock ¶
type QueueLimitsBlock ¶
type QueueLimitsConfig ¶
type QueueRetentionBlock ¶
type QueueRetentionConfig ¶
type RateLimitBlock ¶
type RateLimitConfig ¶
type RetryBlock ¶
type RetryConfig ¶
type Route ¶
type Route struct {
ChannelType ChannelType
Path string
PathQuoted bool
Application string
ApplicationQuoted bool
ApplicationSet bool
EndpointName string
EndpointNameQuoted bool
EndpointNameSet bool
Match *MatchBlock
MatchRefs []string
RateLimit *RateLimitBlock
// Pull and deliver are mutually exclusive in the current MVP slice.
Pull *Pull
Queue *QueueBlock
Deliveries []Deliver
DeliverConcurrency string
DeliverConcurrencyQuoted bool
DeliverConcurrencySet bool
MaxBody string
MaxBodyQuoted bool
MaxBodySet bool
MaxHeaders string
MaxHeadersQuoted bool
MaxHeadersSet bool
Publish *PublishBlock
AuthBasic []BasicAuth
AuthForward *ForwardAuthBlock
// AuthHMACSecrets holds secret references for ingress HMAC verification.
AuthHMACSecrets []string
AuthHMACSecretsQuoted []bool
AuthHMACSecretIsRef []bool
AuthHMACBlockSet bool
AuthHMACSignatureHeader string
AuthHMACSignatureHeaderQuoted bool
AuthHMACSignatureHeaderSet bool
AuthHMACTimestampHeader string
AuthHMACTimestampHeaderQuoted bool
AuthHMACTimestampHeaderSet bool
AuthHMACNonceHeader string
AuthHMACNonceHeaderQuoted bool
AuthHMACNonceHeaderSet bool
AuthHMACTolerance string
AuthHMACToleranceQuoted bool
AuthHMACToleranceSet bool
}
type RuntimeLogBlock ¶
type SecretBlock ¶
type SecretConfig ¶
type SecretsBlock ¶
type SecretsBlock struct {
Items []SecretBlock
}
type TracingBlock ¶
type TracingBlock struct {
Enabled string
EnabledQuoted bool
EnabledSet bool
Collector string
CollectorQuoted bool
CollectorSet bool
URLPath string
URLPathQuoted bool
URLPathSet bool
Timeout string
TimeoutQuoted bool
TimeoutSet bool
Compression string
CompressionQuoted bool
CompressionSet bool
Insecure string
InsecureQuoted bool
InsecureSet bool
ProxyURL string
ProxyURLQuoted bool
ProxyURLSet bool
TLS *TracingTLSBlock
Retry *TracingRetryBlock
Headers []TracingHeader
// contains filtered or unexported fields
}
type TracingHeader ¶
type TracingHeaderConfig ¶
type TracingRetryBlock ¶
type TracingRetryConfig ¶
type TracingTLSBlock ¶
type TracingTLSBlock struct {
CAFile string
CAFileQuoted bool
CAFileSet bool
CertFile string
CertFileQuoted bool
CertFileSet bool
KeyFile string
KeyFileQuoted bool
KeyFileSet bool
ServerName string
ServerNameQuoted bool
ServerNameSet bool
InsecureSkipVerify string
InsecureSkipVerifyQuoted bool
InsecureSkipVerifySet bool
}
type TrendSignalsBlock ¶
type TrendSignalsBlock struct {
Window string
WindowQuoted bool
WindowSet bool
ExpectedCaptureInterval string
ExpectedCaptureIntervalQuoted bool
ExpectedCaptureIntervalSet bool
StaleGraceFactor string
StaleGraceFactorQuoted bool
StaleGraceFactorSet bool
SustainedGrowthConsecutive string
SustainedGrowthConsecutiveQuoted bool
SustainedGrowthConsecutiveSet bool
SustainedGrowthMinSamples string
SustainedGrowthMinSamplesQuoted bool
SustainedGrowthMinSamplesSet bool
SustainedGrowthMinDelta string
SustainedGrowthMinDeltaQuoted bool
SustainedGrowthMinDeltaSet bool
RecentSurgeMinTotal string
RecentSurgeMinTotalQuoted bool
RecentSurgeMinTotalSet bool
RecentSurgeMinDelta string
RecentSurgeMinDeltaQuoted bool
RecentSurgeMinDeltaSet bool
RecentSurgePercent string
RecentSurgePercentQuoted bool
RecentSurgePercentSet bool
QueuedPressureMinTotal string
QueuedPressureMinTotalQuoted bool
QueuedPressureMinTotalSet bool
QueuedPressurePercent string
QueuedPressurePercentQuoted bool
QueuedPressurePercentSet bool
QueuedPressureLeasedMultiplier string
QueuedPressureLeasedMultiplierQuoted bool
QueuedPressureLeasedMultiplierSet bool
}
type TrendSignalsConfig ¶
type TrendSignalsConfig struct {
Window time.Duration
ExpectedCaptureInterval time.Duration
StaleGraceFactor int
SustainedGrowthConsecutive int
SustainedGrowthMinSamples int
SustainedGrowthMinDelta int
RecentSurgeMinTotal int
RecentSurgeMinDelta int
RecentSurgePercent int
QueuedPressureMinTotal int
QueuedPressurePercent int
QueuedPressureLeasedMultiplier int
}
type ValidationResult ¶
type ValidationResult struct {
OK bool `json:"ok"`
Errors []string `json:"errors,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
func ValidateWithResult ¶
func ValidateWithResult(cfg *Config) ValidationResult