yaml

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowLocalFileAccess bool

AllowLocalFileAccess mirrors the -allow-local-file-access (-lfa) option for the preprocessing stage. When false (the default), include directives are confined to the nuclei-templates directory and the including template's own directory.

View Source
var StrictSyntax bool

StrictSyntax determines if pre-processing directives should be observed

View Source
var TemplateBaseDirProvider func() string

TemplateBaseDirProvider, when set, returns an additional directory under which include directives are permitted (in addition to the including template's own directory). It is wired up by the catalog/config package to avoid an import cycle between this low-level utility package and catalog/config.

Functions

func DecodeAndValidate

func DecodeAndValidate(r io.Reader, v interface{}) error

DecodeAndValidate is a wrapper for yaml Decode adding struct validation

func Marshal added in v3.10.0

func Marshal(v interface{}) ([]byte, error)

Marshal serializes a value to YAML.

func PreProcess

func PreProcess(data []byte, templatePath string) ([]byte, error)

PreProcess all include directives. templatePath is the path of the template currently being processed and is used to resolve relative include paths and to validate them.

func Unmarshal added in v3.10.0

func Unmarshal(data []byte, v interface{}) error

Unmarshal deserializes YAML using yaml.v2-compatible lax duplicate-key behavior. In lax mode yaml.v2 allowed duplicate mapping keys and kept the last value; yaml.v3 rejects duplicates by default, so normalize first.

func UnmarshalStrict added in v3.10.0

func UnmarshalStrict(data []byte, v interface{}) error

UnmarshalStrict deserializes YAML and rejects unknown struct fields and duplicate mapping keys.

Types

type Decoder added in v3.10.0

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

Decoder reads YAML documents.

func NewDecoder added in v3.10.0

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a YAML decoder.

func (*Decoder) Decode added in v3.10.0

func (d *Decoder) Decode(v interface{}) error

Decode reads the next YAML document into v.

func (*Decoder) KnownFields added in v3.10.0

func (d *Decoder) KnownFields(enable bool)

KnownFields matches yaml.v3's decoder API.

func (*Decoder) SetStrict added in v3.10.0

func (d *Decoder) SetStrict(strict bool)

SetStrict matches yaml.v2's decoder API.

type Encoder added in v3.10.0

type Encoder = yaml.Encoder

Encoder writes YAML documents.

func NewEncoder added in v3.10.0

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a YAML encoder.

type MapItem added in v3.10.0

type MapItem struct {
	Key   interface{}
	Value interface{}
}

MapItem is a single YAML mapping item.

type MapSlice added in v3.10.0

type MapSlice []MapItem

MapSlice preserves mapping key order for compatibility with yaml.v2.

func (*MapSlice) UnmarshalYAML added in v3.10.0

func (m *MapSlice) UnmarshalYAML(node *Node) error

UnmarshalYAML decodes an ordered map from a yaml.v3 node.

type Marshaler added in v3.10.0

type Marshaler interface {
	MarshalYAML() (interface{}, error)
}

Marshaler is the YAML marshaling interface used by the project.

type Node added in v3.10.0

type Node = yaml.Node

Node is the yaml.v3 syntax tree node type.

type TypeError added in v3.10.0

type TypeError = yaml.TypeError

TypeError is returned for YAML type conversion errors.

type Unmarshaler added in v3.10.0

type Unmarshaler interface {
	UnmarshalYAML(unmarshal func(interface{}) error) error
}

Unmarshaler is the legacy callback-style YAML unmarshaling interface used throughout nuclei. yaml.v3 still supports this shape, but does not export it.

Jump to

Keyboard shortcuts

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