diff options
Diffstat (limited to 'src/cmd/vendor/github.com/google/pprof/internal/plugin')
| -rw-r--r-- | src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go b/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go index d14ac2c215..e5878aed70 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/plugin/plugin.go @@ -17,6 +17,7 @@ package plugin import ( "io" + "net/http" "regexp" "time" @@ -31,6 +32,16 @@ type Options struct { Sym Symbolizer Obj ObjTool UI UI + + // HTTPServer is a function that should block serving http requests, + // including the handlers specfied in args. If non-nil, pprof will + // invoke this function if necessary to provide a web interface. + // + // If HTTPServer is nil, pprof will use its own internal HTTP server. + // + // A common use for a custom HTTPServer is to provide custom + // authentication checks. + HTTPServer func(args *HTTPServerArgs) error } // Writer provides a mechanism to write data under a certain name, @@ -185,3 +196,17 @@ type UI interface { // the auto-completion of cmd, if the UI supports auto-completion at all. SetAutoComplete(complete func(string) string) } + +// HTTPServerArgs contains arguments needed by an HTTP server that +// is exporting a pprof web interface. +type HTTPServerArgs struct { + // Hostport contains the http server address (derived from flags). + Hostport string + + Host string // Host portion of Hostport + Port int // Port portion of Hostport + + // Handlers maps from URL paths to the handler to invoke to + // serve that path. + Handlers map[string]http.Handler +} |
