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") )
View Source
var DefaultGateways = []string{ DefaultGatewayRSS3, DefaultGatewayIPFS, DefaultGatewayCloudflare, DefaultGateway4EVERLAND, }
Functions ¶
Types ¶
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
Click to show internal directories.
Click to hide internal directories.