go-ipfs: github.com/ipfs/go-ipfs/core/corehttp Index | Files

package corehttp

import "github.com/ipfs/go-ipfs/core/corehttp"

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

Index

Package Files

commands.go corehttp.go gateway.go gateway_handler.go gateway_indexPage.go ipns_hostname.go logs.go metrics.go mutex_profile.go proxy.go redirect.go webui.go

Constants

const APIPath = "/api/v0"

APIPath is the path at which the API is mounted.

const WebUIPath = "/ipfs/Qmexhq2sBHnXQbvyP2GfUdbnY7HCagH2Mw5vUNSBn2nxip"

TODO: move to IPNS

Variables

var WebUIOption = RedirectOption("webui", WebUIPath)
var WebUIPaths = []string{
    WebUIPath,
    "/ipfs/QmfQkD8pBSBCBxWEwFSu4XaDVSWK6bjnNuaWZjMyQbyDub",
    "/ipfs/QmXc9raDM1M5G5fpBnVyQ71vR4gbnskwnB9iMEzBuLgvoZ",
    "/ipfs/QmenEBWcAk3tN94fSKpKFtUMwty1qNwSYw3DMDFV6cPBXA",
    "/ipfs/QmUnXcWZC5Ve21gUseouJsH5mLAyz5JPp8aHsg8qVUUK8e",
    "/ipfs/QmSDgpiHco5yXdyVTfhKxr3aiJ82ynz8V14QcGKicM3rVh",
    "/ipfs/QmRuvWJz1Fc8B9cTsAYANHTXqGmKR9DVfY5nvMD1uA2WQ8",
    "/ipfs/QmQLXHs7K98JNQdWrBB2cQLJahPhmupbDjRuH1b9ibmwVa",
    "/ipfs/QmXX7YRpU7nNBKfw75VG7Y1c3GwpSAGHRev67XVPgZFv9R",
    "/ipfs/QmXdu7HWdV6CUaUabd9q2ZeA4iHZLVyDRj3Gi4dsJsWjbr",
    "/ipfs/QmaaqrHyAQm7gALkRW8DcfGX3u8q9rWKnxEMmf7m9z515w",
    "/ipfs/QmSHDxWsMPuJQKWmVA1rB5a3NX2Eme5fPqNb63qwaqiqSp",
    "/ipfs/QmctngrQAt9fjpQUZr7Bx3BsXUcif52eZGTizWhvcShsjz",
    "/ipfs/QmS2HL9v5YeKgQkkWMvs1EMnFtUowTEdFfSSeMT4pos1e6",
    "/ipfs/QmR9MzChjp1MdFWik7NjEjqKQMzVmBkdK3dz14A6B5Cupm",
    "/ipfs/QmRyWyKWmphamkMRnJVjUTzSFSAAZowYP4rnbgnfMXC9Mr",
    "/ipfs/QmU3o9bvfenhTKhxUakbYrLDnZU7HezAVxPM6Ehjw9Xjqy",
    "/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ",
    "/ipfs/QmQNHd1suZTktPRhP7DD4nKWG46ZRSxkwHocycHVrK3dYW",
    "/ipfs/QmNyMYhwJUS1cVvaWoVBhrW8KPj1qmie7rZcWo8f1Bvkhz",
    "/ipfs/QmVTiRTQ72qiH4usAGT4c6qVxCMv4hFMUH9fvU6mktaXdP",
    "/ipfs/QmYcP4sp1nraBiCYi6i9kqdaKobrK32yyMpTrM5JDA8a2C",
    "/ipfs/QmUtMmxgHnDvQq4bpH6Y9MaLN1hpfjJz5LZcq941BEqEXs",
    "/ipfs/QmPURAjo3oneGH53ovt68UZEBvsc8nNmEhQZEpsVEQUMZE",
    "/ipfs/QmeSXt32frzhvewLKwA1dePTSjkTfGVwTh55ZcsJxrCSnk",
    "/ipfs/QmcjeTciMNgEBe4xXvEaA4TQtwTRkXucx7DmKWViXSmX7m",
    "/ipfs/QmfNbSskgvTXYhuqP8tb9AKbCkyRcCy3WeiXwD9y5LeoqK",
    "/ipfs/QmPkojhjJkJ5LEGBDrAvdftrjAYmi9GU5Cq27mWvZTDieW",
}

this is a list of all past webUI paths.

func ListenAndServe Uses

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 Uses

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

type GatewayConfig Uses

type GatewayConfig struct {
    Headers      map[string][]string
    Writable     bool
    PathPrefixes []string
}

type IpfsNodeCollector Uses

type IpfsNodeCollector struct {
    Node *core.IpfsNode
}

func (IpfsNodeCollector) Collect Uses

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

func (IpfsNodeCollector) Describe Uses

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

func (IpfsNodeCollector) PeersTotalValues Uses

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

type ServeOption Uses

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 CheckVersionOption Uses

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 `/go-ipfs/`

func CommandsOption Uses

func CommandsOption(cctx oldcmds.Context) ServeOption

CommandsOption constructs a ServerOption for hooking the commands into the HTTP server.

func CommandsROOption Uses

func CommandsROOption(cctx oldcmds.Context) ServeOption

CommandsROOption constructs a ServerOption for hooking the read-only commands into the HTTP server.

func GatewayOption Uses

func GatewayOption(writable bool, paths ...string) ServeOption

func IPNSHostnameOption Uses

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 Uses

func LogOption() ServeOption

func MetricsCollectionOption Uses

func MetricsCollectionOption(handlerName string) ServeOption

This adds collection of net/http-related metrics

func MetricsScrapingOption Uses

func MetricsScrapingOption(path string) ServeOption

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

func MutexFractionOption Uses

func MutexFractionOption(path string) ServeOption

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

func ProxyOption Uses

func ProxyOption() ServeOption

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

func RedirectOption Uses

func RedirectOption(path string, redirect string) ServeOption

func VersionOption Uses

func VersionOption() ServeOption

Package corehttp imports 53 packages (graph) and is imported by 30 packages. Updated 2019-12-05. Refresh now. Tools for package owners.