Documentation
¶
Overview ¶
Package decode is the second pipeline stage: it decodes base64, URL, JSON-escaped and env-file encodings and expands archives in memory within configured size, depth and entry limits.
Index ¶
Constants ¶
const ( // PassThrough is the adapter that emits each chunk unchanged. PassThrough = "passthrough" // Standard is the adapter that also decodes base64, percent-encoding, JSON // escapes and env-file values, recursively. Standard = "standard" )
Adapter names.
const ( // DetailMaxDepth: a span nested deeper than MaxDepth was not decoded. DetailMaxDepth = "max_depth" // DetailSizeBudget: the decoded bytes of one chunk reached their budget. DetailSizeBudget = "size_budget" )
Detail codes of decode_depth_limit warnings.
const DefaultMaxDepth = 3
DefaultMaxDepth is the decoding depth used when Options.MaxDepth is 0 or less.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decoder ¶
type Decoder interface {
Decode(ctx context.Context, c candidate.Chunk, emit func(candidate.Chunk) bool, warn func(model.Warning))
}
Decoder is the decode stage interface. Decode emits the chunk itself first and then every chunk decoded from it; emit returns false when the scan is stopping, and Decode then returns early. warn receives decode warnings (codes only, never content). Decode never errors, never panics and never logs: input that does not decode is simply not decoded.