mirror of https://github.com/cbeuw/Cloak
Make pprof optional
This commit is contained in:
parent
b522d4a407
commit
3fb8f0656e
|
|
@ -185,10 +185,6 @@ func dispatchConnection(conn net.Conn, sta *server.State) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
runtime.SetBlockProfileRate(5)
|
|
||||||
go func() {
|
|
||||||
log.Println(http.ListenAndServe("0.0.0.0:8001", nil))
|
|
||||||
}()
|
|
||||||
// Should be 127.0.0.1 to listen to ss-server on this machine
|
// Should be 127.0.0.1 to listen to ss-server on this machine
|
||||||
var localHost string
|
var localHost string
|
||||||
// server_port in ss config, same as remotePort in plugin mode
|
// server_port in ss config, same as remotePort in plugin mode
|
||||||
|
|
@ -218,6 +214,8 @@ func main() {
|
||||||
genUID := flag.Bool("u", false, "Generate a UID")
|
genUID := flag.Bool("u", false, "Generate a UID")
|
||||||
genKeyPair := flag.Bool("k", false, "Generate a pair of public and private key, output in the format of pubkey,pvkey")
|
genKeyPair := flag.Bool("k", false, "Generate a pair of public and private key, output in the format of pubkey,pvkey")
|
||||||
|
|
||||||
|
pprofAddr := flag.String("d", "", "debug use: ip:port to be listened by pprof profiler")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *askVersion {
|
if *askVersion {
|
||||||
|
|
@ -238,6 +236,14 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *pprofAddr != "" {
|
||||||
|
runtime.SetBlockProfileRate(5)
|
||||||
|
go func() {
|
||||||
|
log.Println(http.ListenAndServe(*pprofAddr, nil))
|
||||||
|
}()
|
||||||
|
log.Println("pprof listening on " + *pprofAddr)
|
||||||
|
}
|
||||||
|
|
||||||
if *localAddr == "" {
|
if *localAddr == "" {
|
||||||
log.Fatal("Must specify localAddr")
|
log.Fatal("Must specify localAddr")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue