rqdata

package
v0.0.0-...-a98ece3 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extractor

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

Extractor implements a Value(name) (value, valid) function which allow to extract data from an existing DNS Request(or state)

func NewExtractor

func NewExtractor(r request.Request, m *Mapping) *Extractor

NewExtractor return a new Extractor based on the Mapping and the Request provided

func (*Extractor) Value

func (rd *Extractor) Value(name string) (string, bool)

Value extract the data that is mapped to this name and return the corresponding value as a string if that value is empty then the defaultValue is returned Second parameter is a boolean that inform if the name itself is supported in the mapping

type Mapping

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

Mapping define the mapping between 'name' of data and the way to extract that data from the Request it also defines what will be the empty value returned if the data behind the name is empty. it is pretty static, and you should need to instantiate only once

func NewMapping

func NewMapping(emptyValue string) *Mapping

NewMapping build the mapping name -> func to extract data from the Request

func (*Mapping) ValidField

func (m *Mapping) ValidField(name string) bool

Jump to

Keyboard shortcuts

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