From 01ef6a104d77621a48e6b319f53b069c34c75107 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Sun, 5 Aug 2018 21:53:43 +0000 Subject: [PATCH] Eliminate connectionTrackerConfig struct --- probe/endpoint/connection_tracker.go | 19 ++----------------- probe/endpoint/reporter.go | 18 +++--------------- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/probe/endpoint/connection_tracker.go b/probe/endpoint/connection_tracker.go index 73c0861df..9b8495fa2 100644 --- a/probe/endpoint/connection_tracker.go +++ b/probe/endpoint/connection_tracker.go @@ -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(), diff --git a/probe/endpoint/reporter.go b/probe/endpoint/reporter.go index 2d805b2d9..2678a3174 100644 --- a/probe/endpoint/reporter.go +++ b/probe/endpoint/reporter.go @@ -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 */)), } }