servicemap

package
v0.0.0-...-dcb2eba Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NotFoundEntryTimeout is the expire time to recheck for IPs not found
	NotFoundEntryTimeout int64 = 60 * 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CName

type CName struct {
	Expire int64
}

CName contains the timeout information

type DNSMap

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

DNSData contains the saved entries extracted from DNS queries

func NewDNSMap

func NewDNSMap() (*DNSMap, error)

NewDNSData generates a new DNSData structure

func (*DNSMap) ParseDNSResponseAllMatches

func (dc *DNSMap) ParseDNSResponseAllMatches(dns layers.DNS, pTs int64) (string, []string, []ServiceID, bool, int64)

ParseDNSResponseAllMatches matches a DNS response to the configured services. Returns all matching entries. First tries to match by domain, then by regex, and finally by IP address.

func (*DNSMap) ParseDNSResponseFirstMatch

func (dc *DNSMap) ParseDNSResponseFirstMatch(dns layers.DNS) (string, string, []ServiceID, bool, int64)

ParseDNSResponseFirstMatch matches a DNS response to the configured services. Returns the first matching entry. First tries to match by domain, then by regex, and finally by IP address.

type Domain

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

type Filter

type Filter struct {
	// DomainsString is the list of domains to match
	DomainsString []string
	// DomainsRegex is the list of regexes to match
	DomainsRegex []string
	// Prefixes is the list of subnets to match
	Prefixes []string
}

type IPCache

type IPCache struct {
	IPCacheMap *cache.SimpleTimeCache
}

IPCache contains the saved entries extracted from DNS queries and IP prefix matches

func NewIPCache

func NewIPCache(cleanupTime, evictTime time.Duration) (*IPCache, error)

func (*IPCache) Insert

func (dc *IPCache) Insert(ip string, services []ServiceID, ttl int64)

Insert new entry in the IPCache

func (*IPCache) Lookup

func (dc *IPCache) Lookup(ip string) ([]ServiceID, bool)

Lookup allows to lookup entries in the cache map

type IPMap

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

IPMap contains the saved entries extracted from DNS queries

func NewIPMap

func NewIPMap() (*IPMap, error)

NewIPData generates a new DNSCache structure

type Pattern

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

type Prefix

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

Prefix

type Service

type Service struct {
	// Name of the service
	Name string
	// Code of the service
	Code ServiceID
	// ServiceFilter is the ensemble of filters to use for matching
	ServiceFilter Filter
}

type ServiceID

type ServiceID uint16

type ServiceMap

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

ServiceMap contains all the data structures required to support service mappings

func NewServiceMap

func NewServiceMap(cleanupTime, evictTime time.Duration) (*ServiceMap, error)

NewServiceMap generates a new ServiceMap structure

func (*ServiceMap) ConfigServiceMap

func (sm *ServiceMap) ConfigServiceMap(services []Service) error

func (*ServiceMap) GetId

func (sm *ServiceMap) GetId(name string) (ServiceID, bool)

func (*ServiceMap) GetName

func (sm *ServiceMap) GetName(id ServiceID) (string, bool)

func (*ServiceMap) GetService

func (sm *ServiceMap) GetService(id ServiceID) (*Service, bool)

func (*ServiceMap) LookupIP

func (sm *ServiceMap) LookupIP(ip string) ([]ServiceID, bool)

Lookup allows to lookup entries in the cache map

func (*ServiceMap) ParseDNSResponse

func (sm *ServiceMap) ParseDNSResponse(dns layers.DNS)

ParseDNSResponse matches a DNS response to the configured services. First tries to match by domain, then by regex, and finally by IP address.

Jump to

Keyboard shortcuts

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