label

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

Label filter plguin

The label filter plugin adds labels to DNSTAP extra field. It can get label value by dnsutils getter functions.

Parameters

Name type Required Default Description
Add []AddLabel no Add settings
Del []DelLabel no Del settings

AddLabel

Name type Required Default Description
Name string yes Label name
Type enum("DNSTAP","DNS","STATIC") yes
Value string yes Type: DNSTAP, Value Type: getter.DnstapGetterName
Type: DNS, Value Type: getter.DnsMsgGetterName
Type: STATIC, Value Type: add this value

DelLabel

Name type Required Default Description
Name string yes Label name

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(raw json.RawMessage) (types.FilterPlugin, error)

Types

type AddLabel

type AddLabel struct {
	// Label key name for adding or updating. It must not be empty.
	Name string
	// Type can be one of `DNSTAP`, `DNS`, or `STATIC`.
	Type AddLabelType
	// If `Type` is `DNSTAP`, the function name of DNSTAP of the getter function is set to value, and the value of DNSTAP message can be written in the label.
	// You can see getter names https://pkg.go.dev/github.com/mimuret/dnsutils/getter#DnstapGetterName.
	// If `Type` is `DNS`, the function name of the DNS message of the getter function is set to value, and the value of the DNS message can be written into the label.
	// You can see getter names https://pkg.go.dev/github.com/mimuret/dnsutils/getter#DnsMsgGetterName.
	// If the Type is `STATIC`, the string of the value is written directly into the label.
	Value string
	// contains filtered or unexported fields
}

func (*AddLabel) Setup

func (l *AddLabel) Setup() error

type AddLabelType

type AddLabelType string
const (
	AddLabelTypeDNSTAP AddLabelType = "DNSTAP"
	AddLabelTypeDNS    AddLabelType = "DNS"
	AddLabelTypeSTATIC AddLabelType = "STATIC"
)

type DelLabel

type DelLabel struct {
	// Label key name for deleting. It must not be empty.
	Name string
}

Delete Label

func (*DelLabel) Validate

func (l *DelLabel) Validate() error

type Label

type Label struct {
	plugin.PluginCommon
	// Adding and updating labels
	Add []*AddLabel
	// Deleting labels
	Del []*DelLabel
}

The label plugin edits labels.

func (*Label) Filter

func (f *Label) Filter(t *types.DnstapMessage) *types.DnstapMessage

Jump to

Keyboard shortcuts

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