Documentation
¶
Overview ¶
Package engine is the heart of netscope: it consumes attributed flows, resolves each to an owning app and a domain, and maintains two sets of counters:
- window accumulators: reset every Bucket and flushed to storage. These back the historical (today/week) queries.
- session accumulators: cumulative since the daemon started, never reset on flush. These back the LIVE dashboard tables, so the view grows steadily instead of emptying every flush interval.
Instantaneous rates are derived from monotonic lifetime totals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Bucket is the storage flush granularity; window counters accumulate for
// one bucket then get written and reset.
Bucket time.Duration
// SnapshotInterval is how often the live snapshot is recomputed.
SnapshotInterval time.Duration
// Retention bounds how long stored samples are kept; zero disables purging.
Retention time.Duration
// Interface is the capture source name, surfaced in snapshots.
Interface string
// LiveTopN caps how many apps/domains the live snapshot carries.
LiveTopN int
// ActiveWindow defines "active now": apps/domains with traffic newer than
// this are counted as active.
ActiveWindow time.Duration
// SessionHorizon prunes session entries idle longer than this to bound
// memory on long-running daemons. Zero keeps everything for the session.
SessionHorizon time.Duration
// SelfPID, when non-zero, is the daemon's own PID; its traffic (e.g. update
// checks) is excluded from accounting.
SelfPID int
// Hinter receives remote IPs with no known hostname for reverse-DNS
// resolution. Optional.
Hinter HostHinter
}
Config tunes the engine timings.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine owns the accumulators and coordinates flushing/snapshots.
func New ¶
New constructs an Engine. res may be nil (everything attributes to "unknown"); store may be nil to run without persistence.
type HostHinter ¶
type HostHinter interface {
Enqueue(ip string)
}
HostHinter is notified of remote IPs that have no known hostname, so it can resolve them out-of-band (reverse DNS). Implemented by internal/revdns.
Click to show internal directories.
Click to hide internal directories.