route: add manhole for pprof reasons

This commit is contained in:
Cadey Ratio 2017-01-23 08:12:44 -08:00
parent 5fe915787d
commit 1e3765e37b
1 changed files with 22 additions and 0 deletions

22
manhole.go Normal file
View File

@ -0,0 +1,22 @@
package main
import (
"log"
"net"
"net/http"
_ "net/http/pprof"
"net/rpc"
)
func init() {
l, err := net.Listen("tcp", "127.0.0.2:0")
if err != nil {
log.Printf("manhole: cannot bind to 127.0.0.2:0: %v", err)
return
}
log.Printf("manhole: Now listening on http://%s", l.Addr())
rpc.HandleHTTP()
go http.Serve(l, nil)
}