route/internal/manhole.go

31 lines
451 B
Go
Raw Normal View History

2017-10-01 13:54:56 +00:00
package internal
import (
"log"
"net"
"net/http"
"net/rpc"
// Add HTTP pprof routes
_ "net/http/pprof"
// Add tracing routes
_ "golang.org/x/net/trace"
2017-10-07 16:50:20 +00:00
// Expvar routes
_ "expvar"
2017-10-01 13:54:56 +00:00
)
func init() {
l, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
log.Printf("manhole: cannot bind to 127.0.0.1:0: %v", err)
return
}
log.Printf("manhole: Now listening on http://%s", l.Addr())
rpc.HandleHTTP()
go http.Serve(l, nil)
}