-
-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'netbirdio:main' into main
- Loading branch information
Showing
44 changed files
with
3,281 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//go:build pprof | ||
// +build pprof | ||
|
||
package cmd | ||
|
||
import ( | ||
"net/http" | ||
_ "net/http/pprof" | ||
"os" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
func init() { | ||
addr := pprofAddr() | ||
go pprof(addr) | ||
} | ||
|
||
func pprofAddr() string { | ||
listenAddr := os.Getenv("NB_PPROF_ADDR") | ||
if listenAddr == "" { | ||
return "localhost:6969" | ||
} | ||
|
||
return listenAddr | ||
} | ||
|
||
func pprof(listenAddr string) { | ||
log.Infof("listening pprof on: %s\n", listenAddr) | ||
if err := http.ListenAndServe(listenAddr, nil); err != nil { | ||
log.Fatalf("Failed to start pprof: %v", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.