diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2021-10-20 06:41:08 +0300 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2021-10-20 06:41:08 +0300 |
| commit | b679462fa687b375ccefd3c11fec3fd96b9b4d60 (patch) | |
| tree | 62539ed177a1dfcf92347737179ea1054401c9bd /cmd/dcat | |
| parent | 5b56cb675fb3b7ad58c5de28760bc19f63a575bb (diff) | |
make pprof bind address configurable
Diffstat (limited to 'cmd/dcat')
| -rw-r--r-- | cmd/dcat/main.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/cmd/dcat/main.go b/cmd/dcat/main.go index 5e35d6f..5fd22ea 100644 --- a/cmd/dcat/main.go +++ b/cmd/dcat/main.go @@ -3,7 +3,6 @@ package main import ( "context" "flag" - "fmt" "os" "sync" @@ -24,7 +23,7 @@ import ( func main() { var args config.Args var displayVersion bool - var pprof int + var pprof string userName := user.Name() @@ -36,7 +35,6 @@ func main() { flag.IntVar(&args.ConnectionsPerCPU, "cpc", config.DefaultConnectionsPerCPU, "How many connections established per CPU core concurrently") flag.IntVar(&args.SSHPort, "port", config.DefaultSSHPort, "SSH server port") - flag.IntVar(&pprof, "pprof", -1, "Start PProf server this port") flag.StringVar(&args.ConfigFile, "cfg", "", "Config file path") flag.StringVar(&args.Discovery, "discovery", "", "Server discovery method") flag.StringVar(&args.LogDir, "logDir", "~/log", "Log dir") @@ -46,6 +44,7 @@ func main() { flag.StringVar(&args.ServersStr, "servers", "", "Remote servers to connect") flag.StringVar(&args.UserName, "user", userName, "Your system user name") flag.StringVar(&args.What, "files", "", "File(s) to read") + flag.StringVar(&pprof, "pprof", "", "Start PProf server this address") flag.Parse() config.Setup(source.Client, &args, flag.Args()) @@ -59,11 +58,9 @@ func main() { wg.Add(1) dlog.Start(ctx, &wg, source.Client) - if pprof > -1 { - // For debugging purposes only - pprofArgs := fmt.Sprintf("0.0.0.0:%d", pprof) - go http.ListenAndServe(pprofArgs, nil) - dlog.Client.Info("Started PProf", pprofArgs) + if pprof != "" { + go http.ListenAndServe(pprof, nil) + dlog.Client.Info("Started PProf", pprof) } client, err := clients.NewCatClient(args) |
