corehttp

package
v0.0.0-...-9fdd194 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0, MIT Imports: 49 Imported by: 0

Documentation

Overview

Package corehttp provides utilities for the webui, gateways, and other high-level HTTP interfaces to IPFS.

Index

Constants

View Source
const APIPath = "/api/" + shell.API_VERSION

APIPath is the path at which the API is mounted.

View Source
const WebUIPath = "/btfs/QmSTcj1pWk972bdtStQtJeu3yCYo1SDShrbEHaEybciTLR" // v2.3.5

Variables

View Source
var DashboardOption = RedirectOption("dashboard", WebUIPath)
View Source
var HostUIOption = RedirectOption("hostui", WebUIPath)
View Source
var WebUIOption = RedirectOption("webui", WebUIPath)
View Source
var WebUIPaths = []string{
	WebUIPath,
	"/btfs/QmPFT7PscyJ1FZ4FeFPFgikszBugQSBFNycPpy5zpK2pZe",
	"/btfs/QmUKCyDc4h9KN93AdZ7ZVqgPProsKs8NAbVJkK3ux9788d",
	"/btfs/QmRdt8SzRBz5px7KfU4hFveJSKzBMFqv73YE4xXJBsVdDJ",
	"/btfs/QmbNHqcL9PEhFdT5mXjNnkaAE8SEFkjr2jD7we2ckTL4Li",
	"/btfs/QmZvpBNMribwdjNMrA9gXz27t2gzbae3N2tbCLtjpRTqJn",
	"/btfs/QmaK77EYUHxKweLFvRY8gbcMTx2qEb7p4S5aWPN6EHX7T1",
	"/btfs/QmXsvmvTTzciHEdbDCCMo55MfrEQ6qnct8B4Wt9aJwHoMY",
	"/btfs/QmZM3CcoWPHiu9E8ugS76a2csooKEAp5YQitgjQC849h4b",
	"/btfs/QmW3VGCuvfhAJcJZRYQeEjJnjQG27kHNhBasrF2TwGniTT",
	"/btfs/QmWDZ94ZMAjts3WSPbFdLUbfLMYbygJR7BNEygVJqxuqfw",
	"/btfs/QmVKKZuhYriR26jAkZGwR7jEPLGARtWZZV3oS2abykwT2U",
	"/btfs/QmPSaMbVPTrcPg8CxW8GRrKYY9YZyxEQek9eKg5is13S9H",
	"/btfs/QmRZYABH4LisEQPQmpzHAAxacDZbsKtnysjzEuZBaug6bG",
	"/btfs/QmRwxtQfzpfaLKYfg3qhxsFfpRm3J3qLXJxDofsLV8ydXq",
}

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".

func Serve

func Serve(node *core.IpfsNode, lis net.Listener, options ...ServeOption) error

Serve accepts incoming HTTP connections on the listener and pass them to ServeOption handlers.

Types

type IpfsNodeCollector

type IpfsNodeCollector struct {
	Node *core.IpfsNode
}

func (IpfsNodeCollector) Collect

func (c IpfsNodeCollector) Collect(ch chan<- prometheus.Metric)

func (IpfsNodeCollector) Describe

func (IpfsNodeCollector) Describe(ch chan<- *prometheus.Desc)

func (IpfsNodeCollector) PeersTotalValues

func (c IpfsNodeCollector) PeersTotalValues() map[string]float64

type ServeOption

type ServeOption func(*core.IpfsNode, net.Listener, *http.ServeMux) (*http.ServeMux, error)

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 BlockProfileRateOption

func BlockProfileRateOption(path string) ServeOption

BlockProfileRateOption allows to set runtime.SetBlockProfileRate via HTTP using POST request with parameter 'rate'. The profiler tries to sample 1 event every <rate> nanoseconds. If rate == 1, then the profiler samples every blocking event. To disable, set rate = 0.

func CheckVersionOption

func CheckVersionOption() ServeOption

CheckVersionOption returns a ServeOption that checks whether the client btfs version matches. Does nothing when the user agent string does not contain `/go-btfs/`

func CommandsOption

func CommandsOption(cctx oldcmds.Context) ServeOption

CommandsOption constructs a ServerOption for hooking the commands into the HTTP server. It will NOT allow GET requests.

func CommandsROOption

func CommandsROOption(cctx oldcmds.Context) ServeOption

CommandsROOption constructs a ServerOption for hooking the read-only commands into the HTTP server. It will allow GET requests.

func CommandsRemoteOption

func CommandsRemoteOption(cctx oldcmds.Context) ServeOption

CommandsRemoteOption constructs a ServerOption for hooking the public-facing, remote commands into the HTTP server.

func GatewayOption

func GatewayOption(paths ...string) ServeOption

func HostnameOption

func HostnameOption() ServeOption

func LogOption

func LogOption() ServeOption

func MetricsCollectionOption

func MetricsCollectionOption(handlerName string) ServeOption

This adds collection of net/http-related metrics

func MetricsOpenCensusCollectionOption

func MetricsOpenCensusCollectionOption() ServeOption

This adds collection of OpenCensus metrics

func MetricsOpenCensusDefaultPrometheusRegistry

func MetricsOpenCensusDefaultPrometheusRegistry() ServeOption

MetricsOpenCensusDefaultPrometheusRegistry registers the default prometheus registry as an exporter to OpenCensus metrics. This means that OpenCensus metrics will show up in the prometheus metrics endpoint

func MetricsScrapingOption

func MetricsScrapingOption(path string) ServeOption

This adds the scraping endpoint which Prometheus uses to fetch metrics.

func MutexFractionOption

func MutexFractionOption(path string) ServeOption

MutexFractionOption allows to set runtime.SetMutexProfileFraction via HTTP using POST request with parameter 'fraction'.

func P2PProxyOption

func P2PProxyOption() ServeOption

P2PProxyOption is an endpoint for proxying a HTTP request to another btfs peer

func RedirectOption

func RedirectOption(path string, redirect string) ServeOption

func VersionOption

func VersionOption() ServeOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL