Merge pull request #5063 from Crypt-iQ/pprof_patch_03022021
lnd: optionally serve pprof on localhost for better security
This commit is contained in:
2 files changed
+30
-11
No files matched your search
@@ -227,11 +227,11 @@ func Main(cfg *Config, lisCfg ListenerCfg, interceptor signal.Interceptor) error
|
||||
// Enable http profiling server if requested.
|
||||
if cfg.Profile != "" {
|
||||
go func() {
|
||||
listenAddr := net.JoinHostPort("", cfg.Profile)
|
||||
profileRedirect := http.RedirectHandler("/debug/pprof",
|
||||
http.StatusSeeOther)
|
||||
http.Handle("/", profileRedirect)
|
||||
fmt.Println(http.ListenAndServe(listenAddr, nil))
|
||||
ltndLog.Infof("Pprof listening on %v", cfg.Profile)
|
||||
fmt.Println(http.ListenAndServe(cfg.Profile, nil))
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user