Documentation ¶
Overview ¶
Package corehttp provides utilities for the webui, gateways, and other high-level HTTP interfaces to IPFS.
Index ¶
- Constants
- Variables
- func ListenAndServe(n *core.IpfsNode, listeningMultiAddr string, options ...ServeOption) error
- func Serve(node *core.IpfsNode, lis net.Listener, options ...ServeOption) error
- type GatewayConfig
- type IpfsNodeCollector
- type ServeOption
- func CommandsOption(cctx commands.Context) ServeOption
- func CommandsROOption(cctx commands.Context) ServeOption
- func GatewayOption(paths ...string) ServeOption
- func IPNSHostnameOption() ServeOption
- func LogOption() ServeOption
- func MetricsCollectionOption(handlerName string) ServeOption
- func MetricsScrapingOption(path string) ServeOption
- func RedirectOption(path string, redirect string) ServeOption
- func VersionOption() ServeOption
Constants ¶
const WebUIPath = "/ipfs/QmU3o9bvfenhTKhxUakbYrLDnZU7HezAVxPM6Ehjw9Xjqy"
TODO: move to IPNS
Variables ¶
var WebUIOption = RedirectOption("webui", WebUIPath)
var WebUIPaths = []string{ WebUIPath, "/ipfs/QmXX7YRpU7nNBKfw75VG7Y1c3GwpSAGHRev67XVPgZFv9R", "/ipfs/QmXdu7HWdV6CUaUabd9q2ZeA4iHZLVyDRj3Gi4dsJsWjbr", "/ipfs/QmaaqrHyAQm7gALkRW8DcfGX3u8q9rWKnxEMmf7m9z515w", "/ipfs/QmSHDxWsMPuJQKWmVA1rB5a3NX2Eme5fPqNb63qwaqiqSp", "/ipfs/QmctngrQAt9fjpQUZr7Bx3BsXUcif52eZGTizWhvcShsjz", "/ipfs/QmS2HL9v5YeKgQkkWMvs1EMnFtUowTEdFfSSeMT4pos1e6", "/ipfs/QmR9MzChjp1MdFWik7NjEjqKQMzVmBkdK3dz14A6B5Cupm", "/ipfs/QmRyWyKWmphamkMRnJVjUTzSFSAAZowYP4rnbgnfMXC9Mr", }
this is a list of all past webUI paths.
Functions ¶
func ListenAndServe ¶
func ListenAndServe(n *core.IpfsNode, listeningMultiAddr string, options ...ServeOption) error
ListenAndServe runs an HTTP server listening at |listeningMultiAddr| with the given serve options. The address must be provided in multiaddr format.
TODO intelligently parse address strings in other formats so long as they unambiguously map to a valid multiaddr. e.g. for convenience, ":8080" should map to "/ip4/0.0.0.0/tcp/8080".
Types ¶
type GatewayConfig ¶
type IpfsNodeCollector ¶ added in v0.4.1
func (IpfsNodeCollector) Collect ¶ added in v0.4.1
func (c IpfsNodeCollector) Collect(ch chan<- prometheus.Metric)
func (IpfsNodeCollector) Describe ¶ added in v0.4.1
func (_ IpfsNodeCollector) Describe(ch chan<- *prometheus.Desc)
func (IpfsNodeCollector) PeersTotalValues ¶ added in v0.4.3
func (c IpfsNodeCollector) PeersTotalValues() map[string]float64
type ServeOption ¶
ServeOption registers any HTTP handlers it provides on the given mux. It returns the mux to expose to future options, which may be a new mux if it is interested in mediating requests to future options, or the same mux initially passed in if not.
func CommandsOption ¶
func CommandsOption(cctx commands.Context) ServeOption
func CommandsROOption ¶ added in v0.3.8
func CommandsROOption(cctx commands.Context) ServeOption
func GatewayOption ¶
func GatewayOption(paths ...string) ServeOption
func IPNSHostnameOption ¶
func IPNSHostnameOption() ServeOption
IPNSHostnameOption rewrites an incoming request if its Host: header contains an IPNS name. The rewritten request points at the resolved name on the gateway handler.
func LogOption ¶ added in v0.3.6
func LogOption() ServeOption
func MetricsCollectionOption ¶ added in v0.4.1
func MetricsCollectionOption(handlerName string) ServeOption
This adds collection of net/http-related metrics
func MetricsScrapingOption ¶ added in v0.4.1
func MetricsScrapingOption(path string) ServeOption
This adds the scraping endpoint which Prometheus uses to fetch metrics.
func RedirectOption ¶
func RedirectOption(path string, redirect string) ServeOption
func VersionOption ¶
func VersionOption() ServeOption