Documentation
¶
Overview ¶
go-trustless-utils is a set of utilities for working with the IPFS Trustless Gateway protocol as defined at
https://specs.ipfs.tech/http-gateways/trustless-gateway/
The utilities contained here should be useful for building server and client implementations of the protocol.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PathEscape ¶
PathEscape both cleans an IPLD path and URL escapes it so that it can be used in a URL path.
Types ¶
type ByteRange ¶
ByteRange is used to represent the "entity-bytes" parameter of the IPFS Trustless Gateway protocol.
func ParseByteRange ¶
ParseByteRange parses a string form of a ByteRange into a ByteRange. It can be used to parse an "entity-bytes" parameter from a URL.
type DagScope ¶
type DagScope string
DagScope is used to represent the "dag-scope" parameter of the IPFS Trustless Gateway protocol.
const DagScopeAll DagScope = "all"
const DagScopeBlock DagScope = "block"
const DagScopeEntity DagScope = "entity"
func ParseDagScope ¶
ParseDagScope parses a string form of a DagScope into a DagScope.
func (DagScope) TerminalSelectorSpec ¶
func (ds DagScope) TerminalSelectorSpec() builder.SelectorSpec
TerminalSelectorSpec returns the IPLD selector spec that should be used for the terminal of the given DagScope.
type Request ¶
type Request struct {
// Root is the root CID to fetch.
Root cid.Cid
// Path is the optional path within the DAG to fetch.
Path string
// Scope describes the scope of the DAG to fetch. If the Selector parameter
// is not set, Scope and Path will be used to construct a selector.
Scope DagScope
// Bytes is the optional byte range within the DAG to fetch. If not set
// the default byte range will fetch the entire file.
Bytes *ByteRange
// Duplicates is a flag that indicates whether duplicate blocks should be
// stored into the LinkSystem where they occur in the traversal.
Duplicates bool
}
Request describes the parameters of an IPFS Trustless Gateway request. It is intended to be immutable.
func (Request) Etag ¶
Etag produces a string suitable for use as an Etag in an HTTP response for this Request.
func (Request) Selector ¶
Selector generates an IPLD selector for this Request.
Note that only Path, Scope and Bytes are used to generate a selector; so a construction such as the following may be used to easily generate a Trustless Gateway, UnixFS compatible selector:
Request{Path: path, Scope: scope, Bytes: byteRange}.Selector()
Directories
¶
| Path | Synopsis |
|---|---|
|
Package trustlesshttp provides a set of simple utilities and constants useful for clients and servers implementing the IPFS Trustless Gateway protocol.
|
Package trustlesshttp provides a set of simple utilities and constants useful for clients and servers implementing the IPFS Trustless Gateway protocol. |
|
Package traversal provides utilities that operate above the github.com/ipld/go-ipld-prime/traversal system to perform the kinds of traversals required by the IPFS Trustless Gateway protocol, which requires only limited subset of the full go-ipld-prime traversal system.
|
Package traversal provides utilities that operate above the github.com/ipld/go-ipld-prime/traversal system to perform the kinds of traversals required by the IPFS Trustless Gateway protocol, which requires only limited subset of the full go-ipld-prime traversal system. |