Documentation
¶
Index ¶
- Variables
- func DecodeAndValidate(r io.Reader, v interface{}) error
- func Marshal(v interface{}) ([]byte, error)
- func PreProcess(data []byte, templatePath string) ([]byte, error)
- func Unmarshal(data []byte, v interface{}) error
- func UnmarshalStrict(data []byte, v interface{}) error
- type Decoder
- type Encoder
- type MapItem
- type MapSlice
- type Marshaler
- type Node
- type TypeError
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
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.
var StrictSyntax bool
StrictSyntax determines if pre-processing directives should be observed
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 ¶
DecodeAndValidate is a wrapper for yaml Decode adding struct validation
func PreProcess ¶
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
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
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
NewDecoder returns a YAML decoder.
func (*Decoder) KnownFields ¶ added in v3.10.0
KnownFields matches yaml.v3's decoder API.
type Encoder ¶ added in v3.10.0
Encoder writes YAML documents.
func NewEncoder ¶ added in v3.10.0
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
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 Unmarshaler ¶ added in v3.10.0
Unmarshaler is the legacy callback-style YAML unmarshaling interface used throughout nuclei. yaml.v3 still supports this shape, but does not export it.