matcher

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DNSMatcherStatic    = "Static"
	DNSTAPMatcherStatic = "Static"
)

Variables

View Source
var (
	StringToEDE = map[string]uint16{
		"OtherError":                      0,
		"UnsupportedDNSKEYAlgorithm":      1,
		"UnsupportedDSDigestType":         2,
		"StaleAnswer":                     3,
		"ForgedAnswer":                    4,
		"DNSSECIndeterminate":             5,
		"DNSSECBogus":                     6,
		"SignatureExpired":                7,
		"SignatureNotYetValid":            8,
		"DNSKEYMissing":                   9,
		"RRSIGsMissing":                   10,
		"NoZoneKeyBitSet":                 11,
		"NSECMissing":                     12,
		"CachedError":                     13,
		"NotReady":                        14,
		"Blocked":                         15,
		"Censored":                        16,
		"Filtered":                        17,
		"Prohibited":                      18,
		"StaleNXDomainAnswer":             19,
		"NotAuthoritative":                20,
		"NotSupported":                    21,
		"NoReachableAuthority":            22,
		"NetworkError":                    23,
		"InvalidData":                     24,
		"SignatureExpiredbeforeValid":     25,
		"TooEarly":                        26,
		"UnsupportedNSEC3IterationsValue": 27,
		"Unabletoconformtopolicy":         28,
		"Synthesized":                     29,
	}
)

Functions

func GetBool

func GetBool(arg interface{}) (bool, error)

func GetIPNet

func GetIPNet(arg interface{}) (*net.IPNet, error)

func RegisterDnsMsgMatcher

func RegisterDnsMsgMatcher(name MatcherName, newFunc NewDnsMsgMatcher, unmarshaler UnmarshalFunc)

func RegisterDnstapMatcher

func RegisterDnstapMatcher(name MatcherName, newFunc NewDnstapMatcher, unmarshaler UnmarshalFunc)

func UnmarshalBoolArg

func UnmarshalBoolArg(bs json.RawMessage) (interface{}, error)

func UnmarshalStringArg

func UnmarshalStringArg(bs json.RawMessage) (interface{}, error)

func UnmarshalUint32Arg

func UnmarshalUint32Arg(bs json.RawMessage) (interface{}, error)

Types

type Config

type Config struct {
	Op         MatchOp
	Inverse    bool
	Matchers   []MatcherConfig
	SubConfigs []Config
}

type DnsMsgMatcher

type DnsMsgMatcher interface {
	Match(*dns.Msg) bool
}

func BuildDnsMsgMatcher

func BuildDnsMsgMatcher(mc MatcherConfig) (DnsMsgMatcher, error)

func NewMatchDNSMsgAuthenticatedData

func NewMatchDNSMsgAuthenticatedData(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgAuthoritative

func NewMatchDNSMsgAuthoritative(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgCheckingDisabled

func NewMatchDNSMsgCheckingDisabled(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgEDE added in v1.11.0

func NewMatchDNSMsgEDE(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgOpcode

func NewMatchDNSMsgOpcode(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgQueryClass

func NewMatchDNSMsgQueryClass(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgQueryName

func NewMatchDNSMsgQueryName(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgQueryNameRegexp

func NewMatchDNSMsgQueryNameRegexp(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgQueryNameSubDomain added in v1.10.0

func NewMatchDNSMsgQueryNameSubDomain(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgQueryType

func NewMatchDNSMsgQueryType(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgRcode

func NewMatchDNSMsgRcode(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgRecursionAvailable

func NewMatchDNSMsgRecursionAvailable(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgRecursionDesired

func NewMatchDNSMsgRecursionDesired(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgResponse

func NewMatchDNSMsgResponse(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgStatic

func NewMatchDNSMsgStatic(arg interface{}) (DnsMsgMatcher, error)

func NewMatchDNSMsgTruncated

func NewMatchDNSMsgTruncated(arg interface{}) (DnsMsgMatcher, error)

type DnstapMatcher

type DnstapMatcher interface {
	Match(*dnstap.Dnstap) bool
}

func BuildDnstapMatcher

func BuildDnstapMatcher(mc MatcherConfig) (DnstapMatcher, error)

func NewMatchDnstapStatic

func NewMatchDnstapStatic(arg interface{}) (DnstapMatcher, error)

func NewMatchMessageFamily

func NewMatchMessageFamily(arg interface{}) (DnstapMatcher, error)

func NewMatchMessageProtocol

func NewMatchMessageProtocol(arg interface{}) (DnstapMatcher, error)

func NewMatchMessageType

func NewMatchMessageType(arg interface{}) (DnstapMatcher, error)

func NewMatchQueryAddress

func NewMatchQueryAddress(arg interface{}) (DnstapMatcher, error)

func NewMatchQueryPort

func NewMatchQueryPort(arg interface{}) (DnstapMatcher, error)

func NewMatchResponseAddress

func NewMatchResponseAddress(arg interface{}) (DnstapMatcher, error)

func NewMatchResponsePort

func NewMatchResponsePort(arg interface{}) (DnstapMatcher, error)

type IPNet

type IPNet struct {
	net.IPNet
}

func ParseIPNet

func ParseIPNet(str string) (*IPNet, error)

func (IPNet) MarshalJSON

func (i IPNet) MarshalJSON() ([]byte, error)

func (*IPNet) UnmarshalJSON

func (i *IPNet) UnmarshalJSON(b []byte) error

type MatchOp

type MatchOp string
const (
	MatchOpAND MatchOp = "AND"
	MatchOpOR  MatchOp = "OR"
)

func (MatchOp) Get added in v1.0.0

func (m MatchOp) Get() MatchOp

type MatcherConfig

type MatcherConfig struct {
	Type MatcherType
	Name MatcherName
	Arg  interface{}
}

func (*MatcherConfig) UnmarshalJSON

func (c *MatcherConfig) UnmarshalJSON(bs []byte) error

type MatcherName added in v1.0.0

type MatcherName string
const (
	DNSMatcherAuthenticatedData MatcherName = "AuthenticatedData"
	DNSMatcherAD                MatcherName = "AD"
)
const (
	DNSMatcherAuthoritative MatcherName = "Authoritative"
	DNSMatcherAA            MatcherName = "AA"
)
const (
	DNSMatcherCheckingDisabled MatcherName = "CheckingDisabled"
	DNSMatcherCD               MatcherName = "CD"
)
const (
	DNSMatcherRecursionAvailable MatcherName = "RecursionAvailable"
	DNSMatcherRA                 MatcherName = "RA"
)
const (
	DNSMatcherRecursionDesired MatcherName = "RecursionDesired"
	DNSMatcherRD               MatcherName = "RD"
)
const (
	DNSMatcherResponse MatcherName = "Response"
	DNSMatcherQR       MatcherName = "QR"
)
const (
	DNSMatcherTruncated MatcherName = "Truncated"
	DNSMatcherTC        MatcherName = "TC"
)
const (
	DNSMatcherEDE MatcherName = "EDE"
)
const (
	DNSMatcherOpcode MatcherName = "Opcode"
)
const (
	DNSMatcherQClass MatcherName = "QClass"
)
const (
	DNSMatcherQName MatcherName = "QName"
)
const (
	DNSMatcherQNameRegexp MatcherName = "QNameRegexp"
)
const (
	DNSMatcherQNameSubDomain MatcherName = "QNameSubDomain"
)
const (
	DNSMatcherQType MatcherName = "QType"
)
const (
	DNSMatcherRcode MatcherName = "Rcode"
)
const (
	DNSTAPMatcherMessageFamily MatcherName = "MessageFamily"
)
const (
	DNSTAPMatcherMessageProtocol MatcherName = "MessageProtocol"
)
const (
	DNSTAPMatcherMessageType MatcherName = "MessageType"
)
const (
	DNSTAPMatcherQueryAddress MatcherName = "QueryAddress"
)
const (
	DNSTAPMatcherQueryPort MatcherName = "QueryPort"
)
const (
	DNSTAPMatcherResponseAddress MatcherName = "ResponseAddress"
)
const (
	DNSTAPMatcherResponsePort MatcherName = "ResponsePort"
)

func (MatcherName) Get added in v1.0.0

func (m MatcherName) Get() MatcherName

type MatcherSet

type MatcherSet struct {
	Op             SetOp
	Inverse        bool
	DnstapMatchers []DnstapMatcher
	DnsMsgMatchers []DnsMsgMatcher
	SubSets        []*MatcherSet
}

func BuilderMatchSet

func BuilderMatchSet(c *Config) (*MatcherSet, error)

func NewMatcherSet

func NewMatcherSet() *MatcherSet

func (*MatcherSet) Match

func (d *MatcherSet) Match(dt *dnstap.Dnstap, msg *dns.Msg) bool

func (*MatcherSet) MatchDnsMsg

func (d *MatcherSet) MatchDnsMsg(msg *dns.Msg) bool

func (*MatcherSet) MatchDnstap

func (d *MatcherSet) MatchDnstap(dt *dnstap.Dnstap) bool

type MatcherType

type MatcherType string
const (
	MatcherTypeDnstap MatcherType = "DNSTAP"
	MatcherTypeDnsMsg MatcherType = "DNS"
)

func (MatcherType) Equals added in v1.0.0

func (m MatcherType) Equals(c MatcherType) bool

func (MatcherType) Get added in v1.0.0

func (m MatcherType) Get() MatcherType

type NewDnsMsgMatcher

type NewDnsMsgMatcher func(interface{}) (DnsMsgMatcher, error)

type NewDnstapMatcher

type NewDnstapMatcher func(interface{}) (DnstapMatcher, error)

type SetOp added in v1.0.0

type SetOp int
var (
	SetOpAND SetOp = 0
	SetOpOR  SetOp = 1
)

type UnmarshalFunc

type UnmarshalFunc func(json.RawMessage) (interface{}, error)

Jump to

Keyboard shortcuts

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