transformers

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DnstapMessage = map[string]string{
		"AUTH_QUERY": "AQ", "AUTH_RESPONSE": "AR",
		"RESOLVER_QUERY": "RQ", "RESOLVER_RESPONSE": "RR",
		"CLIENT_QUERY": "CQ", "CLIENT_RESPONSE": "CR",
		"FORWARDER_QUERY": "FQ", "FORWARDER_RESPONSE": "FR",
		"STUB_QUERY": "SQ", "STUB_RESPONSE": "SR",
		"TOOL_QUERY": "TQ", "TOOL_RESPONSE": "TR",
		"UPDATE_QUERY": "UQ", "UPDATE_RESPONSE": "UR",
		"DNSQueryType": "Q", "DNSResponseType": "R",
	}
	DNSQr = map[string]string{
		"QUERY": "Q", "REPLY": "R",
	}

	IPversion = map[string]string{
		"INET6": "6", "INET": "4",
	}

	Rcodes = map[string]string{
		"NOERROR": "0", "FORMERR": "1", "SERVFAIL": "2", "NXDOMAIN": "3", "NOIMP": "4", "REFUSED": "5", "YXDOMAIN": "6",
		"YXRRSET": "7", "NXRRSET": "8", "NOTAUTH": "9", "NOTZONE": "10", "DSOTYPENI": "11",
		"BADSIG": "16", "BADKEY": "17", "BADTIME": "18", "BADMODE": "19", "BADNAME": "20", "BADALG": "21", "BADTRUNC": "22", "BADCOOKIE": "23",
	}
)
View Source
var (
	ReturnKeep = 1
	ReturnDrop = 2
)

Functions

func HashIP added in v0.45.0

func HashIP(ip string, algo string) string

Types

type ATagsTransform added in v0.45.0

type ATagsTransform struct {
	GenericTransformer
}

func NewATagsTransform added in v0.43.0

func NewATagsTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *ATagsTransform

func (*ATagsTransform) GetTransforms added in v0.45.0

func (t *ATagsTransform) GetTransforms() ([]Subtransform, error)

type ExtractTransform added in v0.45.0

type ExtractTransform struct {
	GenericTransformer
}

func NewExtractTransform added in v0.43.0

func NewExtractTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *ExtractTransform

func (*ExtractTransform) GetTransforms added in v0.45.0

func (t *ExtractTransform) GetTransforms() ([]Subtransform, error)

type FilteringTransform added in v0.45.0

type FilteringTransform struct {
	GenericTransformer
	// contains filtered or unexported fields
}

func NewFilteringTransform added in v0.43.0

func NewFilteringTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *FilteringTransform

func (*FilteringTransform) GetTransforms added in v0.45.0

func (t *FilteringTransform) GetTransforms() ([]Subtransform, error)

func (*FilteringTransform) LoadDomainsList added in v0.45.0

func (t *FilteringTransform) LoadDomainsList() error

func (*FilteringTransform) LoadQueryIPList added in v0.45.0

func (t *FilteringTransform) LoadQueryIPList() error

func (*FilteringTransform) LoadRcodes added in v0.45.0

func (t *FilteringTransform) LoadRcodes() error

func (*FilteringTransform) LoadrDataIPList added in v0.45.0

func (t *FilteringTransform) LoadrDataIPList() error

type GenericTransformer added in v0.45.0

type GenericTransformer struct {
	LogInfo, LogError func(msg string, v ...interface{})
	// contains filtered or unexported fields
}

func NewTransformer added in v0.45.0

func NewTransformer(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, workerName string, instance int, nextWorkers []chan dnsutils.DNSMessage) GenericTransformer

func (*GenericTransformer) ReloadConfig added in v0.45.0

func (t *GenericTransformer) ReloadConfig(config *pkgconfig.ConfigTransformers)

func (*GenericTransformer) Reset added in v0.45.0

func (t *GenericTransformer) Reset()

type GeoIPTransform added in v0.45.0

type GeoIPTransform struct {
	GenericTransformer
	// contains filtered or unexported fields
}

func NewDNSGeoIPTransform added in v0.43.0

func NewDNSGeoIPTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *GeoIPTransform

func (*GeoIPTransform) Close added in v0.45.0

func (t *GeoIPTransform) Close()

func (*GeoIPTransform) GetTransforms added in v0.45.0

func (t *GeoIPTransform) GetTransforms() ([]Subtransform, error)

func (*GeoIPTransform) Lookup added in v0.45.0

func (t *GeoIPTransform) Lookup(ip string) (GeoRecord, error)

func (*GeoIPTransform) Open added in v0.45.0

func (t *GeoIPTransform) Open() (err error)

func (*GeoIPTransform) Reset added in v0.45.0

func (t *GeoIPTransform) Reset()

type GeoRecord

type GeoRecord struct {
	Continent, CountryISOCode, City, ASN, ASO string
}

type HashQueries added in v0.30.0

type HashQueries struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

hash queries map

func NewHashQueries added in v0.30.0

func NewHashQueries(ttl time.Duration) HashQueries

func (*HashQueries) Delete added in v0.30.0

func (mp *HashQueries) Delete(key uint64)

func (*HashQueries) Get added in v0.30.0

func (mp *HashQueries) Get(key uint64) (value int64, ok bool)

func (*HashQueries) Set added in v0.30.0

func (mp *HashQueries) Set(key uint64, value int64)

func (*HashQueries) SetTTL added in v0.39.0

func (mp *HashQueries) SetTTL(ttl time.Duration)

type LatencyTransform added in v0.45.0

type LatencyTransform struct {
	GenericTransformer
	// contains filtered or unexported fields
}

latency transformer

func NewLatencyTransform added in v0.43.0

func NewLatencyTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *LatencyTransform

func (*LatencyTransform) GetTransforms added in v0.45.0

func (t *LatencyTransform) GetTransforms() ([]Subtransform, error)

type MapQueries added in v0.30.0

type MapQueries struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

queries map

func NewMapQueries added in v0.30.0

func NewMapQueries(ttl time.Duration, channels []chan dnsutils.DNSMessage) MapQueries

func (*MapQueries) Delete added in v0.30.0

func (mp *MapQueries) Delete(key uint64)

func (*MapQueries) Exists added in v0.30.0

func (mp *MapQueries) Exists(key uint64) (ok bool)

func (*MapQueries) Set added in v0.30.0

func (mp *MapQueries) Set(key uint64, dm dnsutils.DNSMessage)

func (*MapQueries) SetTTL added in v0.39.0

func (mp *MapQueries) SetTTL(ttl time.Duration)

type MapTraffic added in v0.31.0

type MapTraffic struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMapTraffic added in v0.31.0

func NewMapTraffic(ttl time.Duration, channels []chan dnsutils.DNSMessage,
	logInfo func(msg string, v ...interface{}), logError func(msg string, v ...interface{})) MapTraffic

func (*MapTraffic) ProcessExpiredKeys added in v0.31.0

func (mp *MapTraffic) ProcessExpiredKeys()

func (*MapTraffic) Run added in v0.31.0

func (mp *MapTraffic) Run()

func (*MapTraffic) Set added in v0.31.0

func (mp *MapTraffic) Set(key string, dm *dnsutils.DNSMessage)

func (*MapTraffic) SetTTL added in v0.39.0

func (mp *MapTraffic) SetTTL(ttl time.Duration)

type MaxminddbRecord

type MaxminddbRecord struct {
	Continent struct {
		Code string `maxminddb:"code"`
	} `maxminddb:"continent"`
	Country struct {
		ISOCode string `maxminddb:"iso_code"`
	} `maxminddb:"country"`
	City struct {
		Names map[string]string `maxminddb:"names"`
	} `maxminddb:"city"`
	AutonomousSystemNumber       int    `maxminddb:"autonomous_system_number"`
	AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"`
}

type MlTransform added in v0.45.0

type MlTransform struct {
	GenericTransformer
}

func NewMachineLearningTransform added in v0.43.0

func NewMachineLearningTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *MlTransform

func (*MlTransform) GetTransforms added in v0.45.0

func (t *MlTransform) GetTransforms() ([]Subtransform, error)

type NormalizeTransform added in v0.45.0

type NormalizeTransform struct {
	GenericTransformer
}

func NewNormalizeTransform added in v0.43.0

func NewNormalizeTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *NormalizeTransform

func (*NormalizeTransform) GetEffectiveTld added in v0.45.0

func (t *NormalizeTransform) GetEffectiveTld(dm *dnsutils.DNSMessage) (int, error)

func (*NormalizeTransform) GetEffectiveTldPlusOne added in v0.45.0

func (t *NormalizeTransform) GetEffectiveTldPlusOne(dm *dnsutils.DNSMessage) (int, error)

func (*NormalizeTransform) GetTransforms added in v0.45.0

func (t *NormalizeTransform) GetTransforms() ([]Subtransform, error)

func (*NormalizeTransform) QnameLowercase added in v0.45.0

func (t *NormalizeTransform) QnameLowercase(dm *dnsutils.DNSMessage) (int, error)

func (*NormalizeTransform) QuietText added in v0.45.0

func (t *NormalizeTransform) QuietText(dm *dnsutils.DNSMessage) (int, error)

func (*NormalizeTransform) RRLowercase added in v0.45.0

func (t *NormalizeTransform) RRLowercase(dm *dnsutils.DNSMessage) (int, error)

func (*NormalizeTransform) ReplaceNonprintable added in v1.0.0

func (t *NormalizeTransform) ReplaceNonprintable(dm *dnsutils.DNSMessage) (int, error)

type ReducerTransform added in v0.45.0

type ReducerTransform struct {
	GenericTransformer
	// contains filtered or unexported fields
}

func NewReducerTransform added in v0.43.0

func NewReducerTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *ReducerTransform

func (*ReducerTransform) GetTransforms added in v0.45.0

func (t *ReducerTransform) GetTransforms() ([]Subtransform, error)

func (*ReducerTransform) ReloadConfig added in v0.45.0

func (t *ReducerTransform) ReloadConfig(config *pkgconfig.ConfigTransformers)

type RelabelTransform added in v0.45.0

type RelabelTransform struct {
	GenericTransformer
	RelabelingRules []dnsutils.RelabelingRule
}

func NewRelabelTransform added in v0.43.0

func NewRelabelTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *RelabelTransform

func (*RelabelTransform) AddRules added in v0.45.0

func (t *RelabelTransform) AddRules(dm *dnsutils.DNSMessage) (int, error)

func (*RelabelTransform) GetTransforms added in v0.45.0

func (t *RelabelTransform) GetTransforms() ([]Subtransform, error)

func (*RelabelTransform) Precompile added in v0.45.0

func (t *RelabelTransform) Precompile() string

Pre-compile regular expressions

type RewriteTransform added in v1.0.0

type RewriteTransform struct {
	GenericTransformer
}

func NewRewriteTransform added in v1.0.0

func NewRewriteTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *RewriteTransform

func (*RewriteTransform) GetTransforms added in v1.0.0

func (t *RewriteTransform) GetTransforms() ([]Subtransform, error)

func (*RewriteTransform) UpdateValues added in v1.0.0

func (t *RewriteTransform) UpdateValues(dm *dnsutils.DNSMessage) (int, error)

type Subtransform added in v0.45.0

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

type SuspiciousTransform added in v0.25.0

type SuspiciousTransform struct {
	GenericTransformer
	// contains filtered or unexported fields
}

func NewSuspiciousTransform added in v0.43.0

func NewSuspiciousTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *SuspiciousTransform

func (*SuspiciousTransform) GetTransforms added in v0.45.0

func (t *SuspiciousTransform) GetTransforms() ([]Subtransform, error)

type TransformEntry added in v0.45.0

type TransformEntry struct {
	Transformation
}

type Transformation added in v0.45.0

type Transformation interface {
	GetTransforms() ([]Subtransform, error)
	ReloadConfig(config *pkgconfig.ConfigTransformers)
	Reset()
}

type Transforms added in v0.25.0

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

func NewTransforms added in v0.25.0

func NewTransforms(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, nextWorkers []chan dnsutils.DNSMessage, instance int) Transforms

func (*Transforms) LogError added in v0.25.0

func (p *Transforms) LogError(msg string, v ...interface{})

func (*Transforms) LogInfo added in v0.25.0

func (p *Transforms) LogInfo(msg string, v ...interface{})

func (*Transforms) Prepare added in v0.25.0

func (p *Transforms) Prepare() error

func (*Transforms) ProcessMessage added in v0.25.0

func (p *Transforms) ProcessMessage(dm *dnsutils.DNSMessage) (int, error)

func (*Transforms) ReloadConfig added in v0.38.0

func (p *Transforms) ReloadConfig(config *pkgconfig.ConfigTransformers)

func (*Transforms) Reset added in v0.25.0

func (p *Transforms) Reset()

type UserPrivacyTransform added in v0.45.0

type UserPrivacyTransform struct {
	GenericTransformer
	// contains filtered or unexported fields
}

func NewUserPrivacyTransform added in v0.43.0

func NewUserPrivacyTransform(config *pkgconfig.ConfigTransformers, logger *logger.Logger, name string, instance int, nextWorkers []chan dnsutils.DNSMessage) *UserPrivacyTransform

func (*UserPrivacyTransform) GetTransforms added in v0.45.0

func (t *UserPrivacyTransform) GetTransforms() ([]Subtransform, error)

Jump to

Keyboard shortcuts

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