corehttp

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 50 Imported by: 1

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/v0"

APIPath is the path at which the API is mounted.

View Source
const WebUIPath = "/ipfs/bafybeigggyffcf6yfhx5irtwzx3cgnk6n3dwylkvcpckzhqqrigsxowjwe" // v4.2.1

WebUI version confirmed to work with this Kubo version

Variables

View Source
var WebUIOption = RedirectOption("webui", WebUIPath)
View Source
var WebUIPaths = []string{
	WebUIPath,
	"/ipfs/bafybeidf7cpkwsjkq6xs3r6fbbxghbugilx3jtezbza7gua3k5wjixpmba",
	"/ipfs/bafybeiamycmd52xvg6k3nzr6z3n33de6a2teyhquhj4kspdtnvetnkrfim",
	"/ipfs/bafybeieqdeoqkf7xf4aozd524qncgiloh33qgr25lyzrkusbcre4c3fxay",
	"/ipfs/bafybeicyp7ssbnj3hdzehcibmapmpuc3atrsc4ch3q6acldfh4ojjdbcxe",
	"/ipfs/bafybeigs6d53gpgu34553mbi5bbkb26e4ikruoaaar75jpfdywpup2r3my",
	"/ipfs/bafybeic4gops3d3lyrisqku37uio33nvt6fqxvkxihrwlqsuvf76yln4fm",
	"/ipfs/bafybeifeqt7mvxaniphyu2i3qhovjaf3sayooxbh5enfdqtiehxjv2ldte",
	"/ipfs/bafybeiequgo72mrvuml56j4gk7crewig5bavumrrzhkqbim6b3s2yqi7ty",
	"/ipfs/bafybeibjbq3tmmy7wuihhhwvbladjsd3gx3kfjepxzkq6wylik6wc3whzy",
	"/ipfs/bafybeiavrvt53fks6u32n5p2morgblcmck4bh4ymf4rrwu7ah5zsykmqqa",
	"/ipfs/bafybeiageaoxg6d7npaof6eyzqbwvbubyler7bq44hayik2hvqcggg7d2y",
	"/ipfs/bafybeidb5eryh72zajiokdggzo7yct2d6hhcflncji5im2y5w26uuygdsm",
	"/ipfs/bafybeibozpulxtpv5nhfa2ue3dcjx23ndh3gwr5vwllk7ptoyfwnfjjr4q",
	"/ipfs/bafybeiednzu62vskme5wpoj4bjjikeg3xovfpp4t7vxk5ty2jxdi4mv4bu",
	"/ipfs/bafybeihcyruaeza7uyjd6ugicbcrqumejf6uf353e5etdkhotqffwtguva",
	"/ipfs/bafybeiflkjt66aetfgcrgvv75izymd5kc47g6luepqmfq6zsf5w6ueth6y",
	"/ipfs/bafybeid26vjplsejg7t3nrh7mxmiaaxriebbm4xxrxxdunlk7o337m5sqq",
	"/ipfs/bafybeif4zkmu7qdhkpf3pnhwxipylqleof7rl6ojbe7mq3fzogz6m4xk3i",
	"/ipfs/bafybeianwe4vy7sprht5sm3hshvxjeqhwcmvbzq73u55sdhqngmohkjgs4",
	"/ipfs/bafybeicitin4p7ggmyjaubqpi3xwnagrwarsy6hiihraafk5rcrxqxju6m",
	"/ipfs/bafybeihpetclqvwb4qnmumvcn7nh4pxrtugrlpw4jgjpqicdxsv7opdm6e",
	"/ipfs/bafybeibnnxd4etu4tq5fuhu3z5p4rfu3buabfkeyr3o3s4h6wtesvvw6mu",
	"/ipfs/bafybeid6luolenf4fcsuaw5rgdwpqbyerce4x3mi3hxfdtp5pwco7h7qyq",
	"/ipfs/bafybeigkbbjnltbd4ewfj7elajsbnjwinyk6tiilczkqsibf3o7dcr6nn4",
	"/ipfs/bafybeicp23nbcxtt2k2twyfivcbrc6kr3l5lnaiv3ozvwbemtrb7v52r6i",
	"/ipfs/bafybeidatpz2hli6fgu3zul5woi27ujesdf5o5a7bu622qj6ugharciwjq",
	"/ipfs/QmfQkD8pBSBCBxWEwFSu4XaDVSWK6bjnNuaWZjMyQbyDub",
	"/ipfs/QmXc9raDM1M5G5fpBnVyQ71vR4gbnskwnB9iMEzBuLgvoZ",
	"/ipfs/QmenEBWcAk3tN94fSKpKFtUMwty1qNwSYw3DMDFV6cPBXA",
	"/ipfs/QmUnXcWZC5Ve21gUseouJsH5m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Bvsc8nNmEhQZEpsVEQUMZE",
	"/ipfs/QmeSXt32frzhvewLKwA1dePTSjkTfGVwTh55ZcsJxrCSnk",
	"/ipfs/QmcjeTciMNgEBe4xXvEaA4TQtwTRkXucx7DmKWViXSmX7m",
	"/ipfs/QmfNbSskgvTXYhuqP8tb9AKbCkyRcCy3WeiXwD9y5LeoqK",
	"/ipfs/QmPkojhjJkJ5LEGBDrAvdftrjAYmi9GU5Cq27mWvZTDieW",
	"/ipfs/Qmexhq2sBHnXQbvyP2GfUdbnY7HCagH2Mw5vUNSBn2nxip",
}

WebUIPaths 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 MakeHandler added in v0.24.0

func MakeHandler(n *core.IpfsNode, l net.Listener, options ...ServeOption) (http.Handler, error)

MakeHandler turns a list of ServeOptions into a http.Handler that implements all of the given options, in order.

func Serve added in v0.3.5

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 added in v0.4.1

type IpfsNodeCollector struct {
	Node *core.IpfsNode
}

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

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 added in v0.18.1

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 added in v0.4.14

func CheckVersionOption() ServeOption

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

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 GatewayOption

func GatewayOption(paths ...string) ServeOption

func HostnameOption added in v0.18.1

func HostnameOption() ServeOption

func Libp2pGatewayOption added in v0.24.0

func Libp2pGatewayOption() ServeOption

func LogOption added in v0.3.6

func LogOption() ServeOption

func MetricsCollectionOption added in v0.4.1

func MetricsCollectionOption(handlerName string) ServeOption

MetricsCollectionOption adds collection of net/http-related metrics.

func MetricsOpenCensusCollectionOption added in v0.18.1

func MetricsOpenCensusCollectionOption() ServeOption

This adds collection of OpenCensus metrics

func MetricsOpenCensusDefaultPrometheusRegistry added in v0.18.1

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 added in v0.4.1

func MetricsScrapingOption(path string) ServeOption

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

func MutexFractionOption added in v0.4.18

func MutexFractionOption(path string) ServeOption

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

func P2PProxyOption added in v0.18.1

func P2PProxyOption() ServeOption

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

func RedirectOption

func RedirectOption(path string, redirect string) ServeOption

func RoutingOption added in v0.24.0

func RoutingOption() ServeOption

func VersionOption

func VersionOption() ServeOption

Jump to

Keyboard shortcuts

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