ipfs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FetchModeQuick  FetchMode = "quick"
	FetchModeStable FetchMode = "stable"

	DefaultTimeout  = 3 * time.Second
	DefaultAttempts = 3
)
View Source
const (
	DefaultGatewayRSS3       = "https://ipfs.rss3.page/"
	DefaultGatewayIPFS       = "https://ipfs.io/"
	DefaultGatewayCloudflare = "https://cloudflare-ipfs.com/"
	DefaultGateway4EVERLAND  = "https://4everland.io/"
)
View Source
const (
	DefaultGatewayList = "https://raw.githubusercontent.com/ipfs/public-gateway-checker/master/gateways.txt"
)

Variables

View Source
var (
	ErrorUnsupportedMode = errors.New("unsupported mode")
	ErrorNoResults       = errors.New("no results")
)

Functions

func FetchGateways

func FetchGateways(ctx context.Context, gatewayList string) ([]string, error)

func ParseURL

func ParseURL(contentURL string) (endpoint, path string, err error)

Types

type FetchMode

type FetchMode string

FetchMode is the mode of fetching data from IPFS gateways.

type HTTPClient

type HTTPClient interface {
	Fetch(ctx context.Context, path string, fetchMode FetchMode) (io.ReadCloser, error)
}

func NewHTTPClient

func NewHTTPClient(options ...HTTPClientOption) (HTTPClient, error)

type HTTPClientOption

type HTTPClientOption func(*httpClient) error

func WithAttempts

func WithAttempts(attempts uint) HTTPClientOption

func WithGateways

func WithGateways(gateways []string) HTTPClientOption

func WithTimeout

func WithTimeout(timeout time.Duration) HTTPClientOption

Jump to

Keyboard shortcuts

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