mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
Eliminate connectionTrackerConfig struct
This commit is contained in:
@@ -12,23 +12,8 @@ import (
|
||||
"github.com/weaveworks/scope/report"
|
||||
)
|
||||
|
||||
// connectionTrackerConfig are the config options for the endpoint tracker.
|
||||
type connectionTrackerConfig struct {
|
||||
HostID string
|
||||
HostName string
|
||||
SpyProcs bool
|
||||
UseConntrack bool
|
||||
WalkProc bool
|
||||
UseEbpfConn bool
|
||||
ProcRoot string
|
||||
BufferSize int
|
||||
ProcessCache *process.CachingWalker
|
||||
Scanner procspy.ConnectionScanner
|
||||
DNSSnooper *DNSSnooper
|
||||
}
|
||||
|
||||
type connectionTracker struct {
|
||||
conf connectionTrackerConfig
|
||||
conf ReporterConfig
|
||||
flowWalker flowWalker // Interface
|
||||
ebpfTracker *EbpfTracker
|
||||
reverseResolver *reverseResolver
|
||||
@@ -37,7 +22,7 @@ type connectionTracker struct {
|
||||
ebpfLastFailureTime time.Time
|
||||
}
|
||||
|
||||
func newConnectionTracker(conf connectionTrackerConfig) connectionTracker {
|
||||
func newConnectionTracker(conf ReporterConfig) connectionTracker {
|
||||
ct := connectionTracker{
|
||||
conf: conf,
|
||||
reverseResolver: newReverseResolver(),
|
||||
|
||||
@@ -57,21 +57,9 @@ var SpyDuration = prometheus.NewSummaryVec(
|
||||
// with process (PID) information.
|
||||
func NewReporter(conf ReporterConfig) *Reporter {
|
||||
return &Reporter{
|
||||
conf: conf,
|
||||
connectionTracker: newConnectionTracker(connectionTrackerConfig{
|
||||
HostID: conf.HostID,
|
||||
HostName: conf.HostName,
|
||||
SpyProcs: conf.SpyProcs,
|
||||
UseConntrack: conf.UseConntrack,
|
||||
WalkProc: conf.WalkProc,
|
||||
UseEbpfConn: conf.UseEbpfConn,
|
||||
ProcRoot: conf.ProcRoot,
|
||||
BufferSize: conf.BufferSize,
|
||||
ProcessCache: conf.ProcessCache,
|
||||
Scanner: conf.Scanner,
|
||||
DNSSnooper: conf.DNSSnooper,
|
||||
}),
|
||||
natMapper: makeNATMapper(newConntrackFlowWalker(conf.UseConntrack, conf.ProcRoot, conf.BufferSize, true /* natOnly */)),
|
||||
conf: conf,
|
||||
connectionTracker: newConnectionTracker(conf),
|
||||
natMapper: makeNATMapper(newConntrackFlowWalker(conf.UseConntrack, conf.ProcRoot, conf.BufferSize, true /* natOnly */)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user