Versions in this module Expand all Collapse all v1 v1.1.0 Mar 22, 2026 Changes in this version + const DefaultMaxExpansionDepth + const DefaultMaxFileSize + const DefaultMaxKeyLength + const DefaultMaxLineLength + const DefaultMaxValueLength + const DefaultMaxVariables + var DefaultPathValidator = NewPathValidator(PathValidatorConfig{}) + var ErrNonASCII = errors.New("string contains non-ASCII characters") + func DefaultMaskKey(key string) string + func IsASCII(s string) bool + func ToUpperASCIISafe(s string) (string, error) + func ValidateFilePath(filename string) error + type AuditLogger interface + LogError func(action Action, key, errMsg string) error + type Dependencies interface type Expander + func (e *Expander) ExpandAllInMap(vars map[string]string) (map[string]string, error) + type KeyValidator interface + ValidateKey func(key string) error + type LineAuditLogger = AuditLogger + type LineExpander = VariableExpander + type LineKeyValidator = KeyValidator type LineParser + func (p *LineParser) SetValueValidator(v LineValueValidator) + type LineParserDependencies = Dependencies + type LineValueValidator = ValueValidator + type PathValidator struct + func NewPathValidator(cfg PathValidatorConfig) *PathValidator + func (v *PathValidator) Validate(filename string) error + type PathValidatorConfig struct + MaskKey func(string) string type ValidatorConfig + ValidateUTF8 bool + type ValueValidator interface + ValidateValue func(value string) error + type VariableExpander interface + Expand func(s string) (string, error) v1.0.1 Mar 19, 2026 v1.0.0 Mar 19, 2026 Changes in this version + const DefaultBufferSize + const DefaultFlushInterval + const HardMaxExpansionDepth + const HardMaxFileSize + const HardMaxKeyLength + const HardMaxLineLength + const HardMaxValueLength + const HardMaxVariables + const MaxPooledBuilderSize + const MaxPooledByteSliceSize + const MaxPooledMapSize + const MaxPooledScannerBufferSize + var ErrFileTooLarge = fmt.Errorf("file exceeds maximum size limit") + var ErrInvalidValue = errors.New("invalid value content") + var ErrLineTooLong = fmt.Errorf("line exceeds maximum length limit") + var ErrMemoryLockNotSupported = errors.New("memory locking not supported on this platform") — js/wasm + var ErrSecurityViolation = errors.New("security policy violation") + var Patterns = []string + func ClearInternCache() + func DetectCycle(vars map[string]string) (string, bool) + func EscapeValue(value string) string + func ExtractNumericIndex(path string) (basePath string, index int, ok bool) + func FlattenJSON(data []byte, cfg JSONFlattenConfig) (map[string]string, error) + func FlattenYAML(value *Value, cfg YAMLFlattenConfig) (map[string]string, error) + func GetBuilder() *strings.Builder + func GetByteSlice() *[]byte + func HashKey(key string, numShards int) uint32 + func InternKey(key string) string + func IsKey(key string) bool + func IsValidJSONKey(key string) bool + func IsYamlNumber(s string) bool + func IsYamlNumberBytes(s []byte) bool + func KeysToUpper(m map[string]string) map[string]bool + func KeysToUpperPooled(m map[string]string) map[string]bool + func LockMemory(_ []byte) error — js/wasm + func LockMemory(data []byte) error — darwin/amd64, linux/amd64, windows/amd64 + func MarshalEnv(m map[string]string, sorted bool) (string, error) + func MarshalEnvAs(m map[string]string, format MarshalFormat, sorted bool) (string, error) + func MaskInString(s string) string + func MaskKey(key string) string + func MaskValue(key, value string) string + func MemLockSupported() bool + func ParseDoubleQuoted(value string) (string, error) + func ParseDoubleQuotedBytes(value []byte) (string, error) + func ParseSingleQuoted(value string) (string, error) + func ParseSingleQuotedBytes(value []byte) (string, error) + func PutBuilder(sb *strings.Builder) + func PutByteSlice(buf *[]byte) + func PutKeysToUpperMap(m map[string]bool) + func ResolvePath(path string) []string + func SanitizeForLog(s string) string + func Struct(v interface{}, prefix string) (map[string]string, error) + func StructInto(data map[string]string, val reflect.Value, prefix string) error + func ToUpperASCII(s string) string + func TrimSpace(s string) string + func TryParseYamlValue(value string) (string, bool) + func TryParseYamlValueBytes(value []byte) (string, bool) + func UnlockMemory(_ []byte) — js/wasm + func UnlockMemory(data []byte) — darwin/amd64, linux/amd64, windows/amd64 + func WriteFile(filename string, buf *bytes.Buffer) (err error) + type Action string + const ActionDelete + const ActionError + const ActionExpand + const ActionFileAccess + const ActionGet + const ActionLoad + const ActionParse + const ActionSecurity + const ActionSet + const ActionValidate + type Auditor struct + func NewAuditor(handler Handler, isSensitive IsSensitiveFunc, masker MaskerFunc, enabled bool) *Auditor + func (a *Auditor) Close() error + func (a *Auditor) IsEnabled() bool + func (a *Auditor) Log(action Action, key, reason string, success bool) error + func (a *Auditor) LogError(action Action, key, errMsg string) error + func (a *Auditor) LogSecurity(key, reason string) error + func (a *Auditor) LogWithDuration(action Action, key, reason string, success bool, duration time.Duration) error + func (a *Auditor) LogWithFile(action Action, key, file, reason string, success bool) error + func (a *Auditor) SetEnabled(enabled bool) + type BufferedHandler struct + func NewBufferedHandler(cfg BufferedHandlerConfig) *BufferedHandler + func (h *BufferedHandler) BufferLen() int + func (h *BufferedHandler) Close() error + func (h *BufferedHandler) Flush() error + func (h *BufferedHandler) IsFull() bool + func (h *BufferedHandler) Log(event Event) error + func (h *BufferedHandler) RequestFlush() + type BufferedHandlerConfig struct + BufferSize int + FlushInterval time.Duration + Handler Handler + OnError func(error) + type ChannelHandler struct + func NewChannelHandler(ch chan<- Event) *ChannelHandler + func (h *ChannelHandler) Close() error + func (h *ChannelHandler) Log(event Event) error + type CloseableChannelHandler struct + func NewCloseableChannelHandler(bufferSize int) *CloseableChannelHandler + func (h *CloseableChannelHandler) Channel() <-chan Event + func (h *CloseableChannelHandler) Close() error + func (h *CloseableChannelHandler) IsClosed() bool + func (h *CloseableChannelHandler) Log(event Event) error + type Event struct + Action Action + Details string + Duration int64 + File string + Key string + Masked bool + Reason string + Success bool + Timestamp time.Time + type Expander struct + func NewExpander(cfg ExpanderConfig) *Expander + func (e *Expander) Expand(s string) (string, error) + type ExpanderConfig struct + KeyPattern *regexp.Regexp + Lookup func(string) (string, bool) + MaxDepth int + Mode Mode + type ExpansionError struct + Chain string + Depth int + Key string + Limit int + func (e *ExpansionError) Error() string + type FileError struct + Err error + Limit int64 + Op string + Path string + Size int64 + func (e *FileError) Error() string + func (e *FileError) Unwrap() error + type Handler interface + Close func() error + Log func(event Event) error + func DefaultHandler() Handler + type IsSensitiveFunc func(key string) bool + type JSONError struct + Err error + Message string + Path string + func (e *JSONError) Error() string + func (e *JSONError) Unwrap() error + type JSONFlattenConfig struct + ArrayIndexFormat string + BoolAsString bool + KeyDelimiter string + MaxDepth int + NullAsEmpty bool + NumberAsString bool + type JSONHandler struct + func NewJSONHandler(w io.Writer) *JSONHandler + func (h *JSONHandler) Close() error + func (h *JSONHandler) Log(event Event) error + type Lexer struct + func NewYAMLLexer(input string) *Lexer + func (l *Lexer) NextToken() (Token, error) + func (l *Lexer) Tokenize() ([]Token, error) + type LineParser struct + func NewLineParser(cfg LineParserConfig, v *Validator, a *Auditor, e *Expander) *LineParser + func (p *LineParser) ExpandAll(vars map[string]string) (map[string]string, error) + func (p *LineParser) ParseLine(line string) (string, string, error) + func (p *LineParser) ParseLineBytes(line []byte) (string, string, error) + func (p *LineParser) ParseValue(value string) (string, error) + func (p *LineParser) ParseValueBytes(value []byte) (string, error) + type LineParserConfig struct + AllowExportPrefix bool + AllowYamlSyntax bool + ExpandVariables bool + MaxVariables int + OverwriteExisting bool + type LogHandler struct + func NewLogHandler(logger *log.Logger) *LogHandler + func (h *LogHandler) Close() error + func (h *LogHandler) Log(event Event) error + type MarshalError struct + Field string + Message string + func (e *MarshalError) Error() string + type MarshalFormat int + const FormatEnv + const FormatJSON + const FormatYAML + type MaskerFunc func(key, value string) string + type Mode int + const ModeAll + const ModeEnv + const ModeNone + type NopHandler struct + func NewNopHandler() *NopHandler + func (h *NopHandler) Close() error + func (h *NopHandler) Log(event Event) error + type ParseError struct + Content string + Err error + File string + Line int + func (e *ParseError) Error() string + func (e *ParseError) Unwrap() error + type Parser struct + func NewYAMLParser(tokens []Token, maxDepth int) *Parser + func (p *Parser) Parse() (*Value, error) + type SecureReader struct + func NewSecureReader(r io.Reader, maxSize int64, maxLineLen int) *SecureReader + func (r *SecureReader) Read(p []byte) (n int, err error) + type SecurityError struct + Action string + Details string + Key string + Reason string + func (e *SecurityError) Error() string + func (e *SecurityError) Is(target error) bool + type Token struct + Column int + Indent int + IsQuoted bool + Line int + Type TokenType + Value string + type TokenType int + const TokenColon + const TokenComment + const TokenDash + const TokenDedent + const TokenDocumentStart + const TokenEOF + const TokenIndent + const TokenKey + const TokenNewline + const TokenValue + type ValidationError struct + Field string + Message string + Rule string + Value string + func (e *ValidationError) Error() string + func (e *ValidationError) Is(target error) bool + type Validator struct + func NewValidator(cfg ValidatorConfig) *Validator + func (v *Validator) IsSensitive(key string) bool + func (v *Validator) MaskValue(key, value string) string + func (v *Validator) ShouldMask(key string) bool + func (v *Validator) ValidateKey(key string) error + func (v *Validator) ValidateRequired(keys map[string]bool) error + func (v *Validator) ValidateValue(value string) error + type ValidatorConfig struct + AllowedKeys []string + ForbiddenKeys []string + IsSensitive func(string) bool + KeyPattern *regexp.Regexp + MaskKey func(string) string + MaskSensitive func(string) string + MaxKeyLength int + MaxValueLength int + RequiredKeys []string + type Value struct + Array []*Value + Column int + Line int + Map map[string]*Value + Scalar string + Type ValueType + func NewArrayValue(line, col int) *Value + func NewMapValue(line, col int) *Value + func NewScalarValue(s string, line, col int) *Value + func ParseYAML(data []byte, maxDepth int) (*Value, error) + type ValueType int + const ValueTypeArray + const ValueTypeMap + const ValueTypeScalar + type YAMLError struct + Column int + Err error + Line int + Message string + Path string + func (e *YAMLError) Error() string + func (e *YAMLError) Unwrap() error + type YAMLFlattenConfig struct + ArrayIndexFormat string + BoolAsString bool + KeyDelimiter string + MaxDepth int + NullAsEmpty bool + NumberAsString bool