From 6622def60bb96652b19e5f63185b1b9cc8b01a48 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 6 Mar 2020 18:18:09 +0000 Subject: make Mr. Lint happy --- internal/config/config.go | 4 ++-- internal/pprof/pprof.go | 18 ------------------ internal/server/server.go | 8 ++++---- 3 files changed, 6 insertions(+), 24 deletions(-) delete mode 100644 internal/pprof/pprof.go (limited to 'internal') diff --git a/internal/config/config.go b/internal/config/config.go index 166e143..7241276 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -9,8 +9,8 @@ import ( // ControlUser is used for various DTail specific operations. const ControlUser string = "DTAIL-CONTROL-USER" -// ScheduledUser is used for scheduled queries. -const ScheduleUser string = "DTAIL-SCHEDULED-USER" +// ScheduleUser is used for scheduled queries. +const ScheduleUser string = "DTAIL-SCHEDULE-USER" // Client holds a DTail client configuration. var Client *ClientConfig diff --git a/internal/pprof/pprof.go b/internal/pprof/pprof.go deleted file mode 100644 index c6d11ca..0000000 --- a/internal/pprof/pprof.go +++ /dev/null @@ -1,18 +0,0 @@ -package pprof - -import ( - "fmt" - "net/http" - _ "net/http" - _ "net/http/pprof" - - "github.com/mimecast/dtail/internal/config" - "github.com/mimecast/dtail/internal/io/logger" -) - -// Start the profiler HTTP server. -func Start() { - bindAddr := fmt.Sprintf("%s:%d", config.Common.PProfBindAddress, config.Common.PProfPort) - logger.Info("Starting PProf server", bindAddr) - go http.ListenAndServe(bindAddr, nil) -} diff --git a/internal/server/server.go b/internal/server/server.go index 0b93537..4ffe4d9 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -224,15 +224,15 @@ func (s *Server) schedueleUserCanHaveSSHSession(addr string, user *user.User, jo continue } for _, myAddr := range job.AllowFrom { - myIps, err := net.LookupIP(myAddr) + myIPs, err := net.LookupIP(myAddr) if err != nil { logger.Error(user, myAddr, err) continue } - for _, myIp := range myIps { - logger.Debug("schedueleUserCanHaveSSHSession", "Comparing IP addresses", ip, myIp.String()) - if ip == myIp.String() { + for _, myIP := range myIPs { + logger.Debug("schedueleUserCanHaveSSHSession", "Comparing IP addresses", ip, myIP.String()) + if ip == myIP.String() { return true } } -- cgit v1.2.3 From a4f8e0926a1a6888cbab1cfd94229cf1cc5cba7d Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 6 Mar 2020 18:21:02 +0000 Subject: simplify and get rid of pperf --- internal/config/common.go | 9 --------- 1 file changed, 9 deletions(-) (limited to 'internal') diff --git a/internal/config/common.go b/internal/config/common.go index 8c07710..57f040c 100644 --- a/internal/config/common.go +++ b/internal/config/common.go @@ -18,12 +18,6 @@ type CommonConfig struct { LogDir string // The cache directory CacheDir string - // Do we want to enable pperf http server? - PProfEnable bool `json:",omitempty"` - // The HTTP port used by PProf - PProfPort int `json:",omitempty"` - // The PProf HTTP server bind address - PProfBindAddress string `json:",omitempty"` } // Create a new default configuration. @@ -35,8 +29,5 @@ func newDefaultCommonConfig() *CommonConfig { ExperimentalFeaturesEnable: false, LogDir: "log", CacheDir: "cache", - PProfEnable: false, - PProfPort: 6060, - PProfBindAddress: "0.0.0.0", } } -- cgit v1.2.3