ipfs

package
v0.0.0-...-d2b7839 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BestGatewayNodeFrom

func BestGatewayNodeFrom(ipfsURL string, isFxHash bool) string

BestGatewayNodeFrom rewrites an IPFS URL to a gateway URL using the appropriate gateway

func DefaultGatewayFrom

func DefaultGatewayFrom(ipfsURL string) string

DefaultGatewayFrom rewrites an IPFS URL to a gateway URL using the default gateway

func GetHeader

func GetHeader(ctx context.Context, path string) (http.Header, error)

func GetResponse

func GetResponse(ctx context.Context, path string) (io.ReadCloser, error)

func IsIpfsGatewayURL

func IsIpfsGatewayURL(ipfsURL string) bool

func IsIpfsProtoURL

func IsIpfsProtoURL(ipfsURL string) bool

func IsIpfsURL

func IsIpfsURL(ipfsURL string) bool

func NewShell

func NewShell() *shell.Shell

NewShell returns an IPFS shell with default configuration

func PathGatewayFrom

func PathGatewayFrom(gatewayHost, ipfsURL string) string

PathGatewayFrom is a helper function that rewrites an IPFS URI to an IPFS gateway URL

Types

type ErrInfuraQuotaExceeded

type ErrInfuraQuotaExceeded struct {
	Err error
}

func (ErrInfuraQuotaExceeded) Error

func (r ErrInfuraQuotaExceeded) Error() string

func (ErrInfuraQuotaExceeded) Unwrap

func (r ErrInfuraQuotaExceeded) Unwrap() error

type HTTPReader

type HTTPReader struct {
	Host   string
	Client *http.Client
}

HTTPReader is a reader that uses a HTTP gateway to read from

func (HTTPReader) Do

func (r HTTPReader) Do(ctx context.Context, path string) (io.ReadCloser, error)

func (HTTPReader) Head

func (r HTTPReader) Head(ctx context.Context, path string) (http.Header, error)

type IPFSReader

type IPFSReader struct {
	Client *shell.Shell
}

IPFSReader is a reader that uses an IPFS shell to read from IPFS

func (IPFSReader) Do

func (r IPFSReader) Do(ctx context.Context, path string) (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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