mirror of
https://github.com/ipfs/kubo.git
synced 2025-10-26 02:45:48 +08:00
ServeOptions take the node and muxer, they should get the listener too as sometimes they need to operate on the listener address. License: MIT Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
18 lines
384 B
Go
18 lines
384 B
Go
package corehttp
|
|
|
|
import (
|
|
"net"
|
|
"net/http"
|
|
|
|
prom "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/prometheus/client_golang/prometheus"
|
|
|
|
"github.com/ipfs/go-ipfs/core"
|
|
)
|
|
|
|
func PrometheusOption(path string) ServeOption {
|
|
return func(n *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
|
|
mux.Handle(path, prom.Handler())
|
|
return mux, nil
|
|
}
|
|
}
|