package
0.0.0-20240618082255-83008eb4fce2
Repository: https://github.com/bittorrent/go-btfs.git
Documentation: pkg.go.dev
# README
IPFS Gateway
A reference implementation of HTTP Gateway Specifications.
Documentation
- Go Documentation: https://pkg.go.dev/github.com/ipfs/boxo/gateway
- Gateway Specification: https://github.com/ipfs/specs/tree/main/http-gateways#readme
- Types of HTTP Gateways: https://docs.ipfs.tech/how-to/address-ipfs-on-web/#http-gateways
Example
// Initialize your headers and apply the default headers.
headers := map[string][]string{}
gateway.AddAccessControlHeaders(headers)
conf := gateway.Config{
Headers: headers,
}
// Initialize a NodeAPI interface for both an online and offline versions.
// The offline version should not make any network request for missing content.
ipfs := ...
// Create http mux and setup path gateway handler.
mux := http.NewServeMux()
gwHandler := gateway.NewHandler(conf, ipfs)
mux.Handle("/ipfs/", gwHandler)
mux.Handle("/ipns/", gwHandler)
// Start the server on :8080 and voilá! You have a basic IPFS gateway running
// in http://localhost:8080.
_ = http.ListenAndServe(":8080", mux)
# Packages
go:generate ./build.sh.
# Functions
AddAccessControlHeaders adds default headers used for controlling cross-origin requests.
No description provided by the author
NewDNSResolver creates a new DNS resolver based on the default resolvers and the provided resolvers.
No description provided by the author
No description provided by the author
NewErrorWithRetryAfter wraps any error in RetryAfter hint that gets passed to HTTP clients in Retry-After HTTP header.
No description provided by the author
No description provided by the author
NewHandler returns an http.Handler that can act as a gateway to IPFS content offlineApi is a version of the API that should not make network requests for missing data.
No description provided by the author
ServeContent replies to the request using the content in the provided ReadSeeker and returns the status code written and any error encountered during a write.
WithHostname is a middleware that can wrap an http.Handler in order to parse the Host header and translating it to the content path.
WithNameSystem sets the name system to use for the gateway.
WithValueStore sets the ValueStore to use for the gateway.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
ByteRange describes a range request within a UnixFS file.
Config is the configuration used when creating a new gateway handler.
No description provided by the author
Custom type for collecting error details to be handled by `webError`.
No description provided by the author
No description provided by the author
TODO: Is this what we want for ImmutablePath?.
Specification is the specification of an btfs Public Gateway.
# Interfaces
IPFSBackend is the required set of functionality used to implement the IPFS HTTP Gateway specification.
# Type aliases
No description provided by the author
No description provided by the author