Documentation ¶
Index ¶
- Constants
- func CacheMulticastMessages(cache *gocache.Cache, msgChan chan *dns.Msg)
- func Download(engine Engine, config *config.GudgeonConfig, list *config.GudgeonList) error
- func MulticastMdnsListen(msgChan chan *dns.Msg, closeChan chan bool)
- func MulticastMdnsQuery()
- func NewRecorder(conf *config.GudgeonConfig, engine Engine, db *sql.DB, metrics Metrics, ...) (*recorder, error)
- func ParseMulticastMessage(msg *dns.Msg) (map[string]string, error)
- func ReadCachedHostname(cache *gocache.Cache, address string) string
- type CacheSizeFunction
- type Engine
- type InfoRecord
- type ListEntry
- type Metric
- type Metrics
- type MetricsAccumulator
- type MetricsEntry
- type QueryAccumulator
- type QueryLog
- type QueryLogQuery
- type ReverseLookupFunction
- type TopInfo
Constants ¶
View Source
const ( // metrics prefix MetricsPrefix = "gudgeon-" // metrics names are prefixed by the metrics prefix and delim TotalRules = "active-rules" TotalQueries = "total-session-queries" TotalLifetimeQueries = "total-lifetime-queries" TotalIntervalQueries = "total-interval-queries" CachedQueries = "cached-queries" BlockedQueries = "blocked-session-queries" BlockedLifetimeQueries = "blocked-lifetime-queries" BlockedIntervalQueries = "blocked-interval-queries" QueriesPerSecond = "session-queries-ps" BlocksPerSecond = "session-blocks-ps" QueryTime = "query-time" QueryTimeAvg = "query-time-avg" // cache entries CurrentCacheEntries = "cache-entries" // runtime metrics GoRoutines = "goroutines" Threads = "process-threads" CurrentlyAllocated = "allocated-bytes" // heap allocation in go runtime stats UsedMemory = "process-used-bytes" // from the process api // cpu metrics CPUHundredsPercent = "cpu-hundreds-percent" // 17 == 0.17 percent, expressed in integer terms // worker metrics (should be qualified with -workertype, ie: "gudgeon-workers-tcp") Workers = "workers" )
Variables ¶
This section is empty.
Functions ¶
func CacheMulticastMessages ¶ added in v0.6.1
func Download ¶ added in v0.1.9
func Download(engine Engine, config *config.GudgeonConfig, list *config.GudgeonList) error
func MulticastMdnsListen ¶ added in v0.6.1
func MulticastMdnsQuery ¶ added in v0.6.1
func MulticastMdnsQuery()
func NewRecorder ¶ added in v0.6.1
func NewRecorder(conf *config.GudgeonConfig, engine Engine, db *sql.DB, metrics Metrics, qlog QueryLog) (*recorder, error)
created from raw engine
func ParseMulticastMessage ¶ added in v0.6.1
Types ¶
type CacheSizeFunction ¶ added in v0.6.1
type CacheSizeFunction = func() int64
type Engine ¶
type Engine interface { IsDomainRuleMatched(consumer *net.IP, domain string) (rule.Match, *config.GudgeonList, string) Resolve(domainName string) (string, error) Reverse(address string) string // different direct handle methods Handle(address *net.IP, protocol string, request *dns.Msg) (*dns.Msg, *resolver.RequestContext, *resolver.ResolutionResult) HandleWithConsumerName(consumerName string, rCon *resolver.RequestContext, request *dns.Msg) (*dns.Msg, *resolver.RequestContext, *resolver.ResolutionResult) HandleWithConsumer(consumer *consumer, rCon *resolver.RequestContext, request *dns.Msg) (*dns.Msg, *resolver.RequestContext, *resolver.ResolutionResult) HandleWithGroups(groups []string, rCon *resolver.RequestContext, request *dns.Msg) (*dns.Msg, *resolver.RequestContext, *resolver.ResolutionResult) HandleWithResolvers(resolvers []string, rCon *resolver.RequestContext, request *dns.Msg) (*dns.Msg, *resolver.RequestContext, *resolver.ResolutionResult) // info, things by name Consumers() *[]string Groups() *[]string Resolvers() *[]string Lists() *[]*ListEntry // stats CacheSize() int64 // inner providers QueryLog() QueryLog Metrics() Metrics // close engine and all resources Close() // shutdown engine and all threads Shutdown() }
func NewReloadingEngine ¶ added in v0.6.11
func NewReloadingEngine(confPath string, conf *config.GudgeonConfig) (Engine, error)
type InfoRecord ¶ added in v0.6.1
type InfoRecord struct { // client address Address string // hold the information but aren't serialized Request *dns.Msg `json:"-"` Response *dns.Msg `json:"-"` Result *resolver.ResolutionResult `json:"-"` RequestContext *resolver.RequestContext `json:"-"` // generated/calculated values Consumer string ClientName string ConnectionType string RequestDomain string RequestType string ResponseText string Rcode string // hard consumer blocked Blocked bool // matching Match rule.Match MatchList string MatchListShort string MatchRule string // cached in resolver cache store Cached bool // when this log record was created Created time.Time Finished time.Time // how long it took to service the request inside the engine ServiceMilliseconds int64 }
info passed over channel and stored in database and that is recovered via the Query method
type Metrics ¶ added in v0.6.1
type Metrics interface { GetAll() *map[string]*Metric Get(name string) *Metric // use cache function UseCacheSizeFunction(function CacheSizeFunction) // Query metrics from db Query(start time.Time, end time.Time) ([]*MetricsEntry, error) QueryFunc(accumulatorFunction MetricsAccumulator, filter string, unmarshall bool, start time.Time, end time.Time) error // top information TopClients(limit int) []*TopInfo TopDomains(limit int) []*TopInfo TopQueryTypes(limit int) []*TopInfo TopLists(limit int) []*TopInfo TopRules(limit int) []*TopInfo // stop the metrics collection Stop() // contains filtered or unexported methods }
func NewMetrics ¶ added in v0.6.1
func NewMetrics(config *config.GudgeonConfig, db *sql.DB) Metrics
type MetricsAccumulator ¶ added in v0.6.11
type MetricsAccumulator = func(entry *MetricsEntry)
allows the same query and row scan logic to share code
type MetricsEntry ¶ added in v0.6.1
type QueryAccumulator ¶ added in v0.6.11
type QueryAccumulator = func(count uint64, info *InfoRecord)
type QueryLog ¶ added in v0.6.1
type QueryLog interface { Query(query *QueryLogQuery) ([]*InfoRecord, uint64) QueryFunc(query *QueryLogQuery, accumulator QueryAccumulator) Stop() // contains filtered or unexported methods }
public interface
func NewQueryLog ¶ added in v0.6.1
create a new query log according to configuration
type QueryLogQuery ¶ added in v0.6.1
type QueryLogQuery struct { // query on fields Address string ClientName string ConnectionType string RequestDomain string RequestType string ResponseText string Blocked *bool Cached *bool // aspects of the match Match *rule.Match MatchList string MatchRule string // query on created time After *time.Time Before *time.Time // query limits for paging Skip int Limit int // query sort SortBy string Direction string }
the type that is used to make queries against the query log (should be used by the web interface to find queries)
type ReverseLookupFunction ¶ added in v0.6.1
allows a dependency injection-way of defining a reverse lookup function, takes a string address (should be an IP) and returns a string that contains the domain name result
Click to show internal directories.
Click to hide internal directories.