httpclient

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0, MIT Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an http client for the indexer find API

func New

func New(baseURL string, options ...Option) (*Client, error)

New creates a new find HTTP client.

func (*Client) Find

func (c *Client) Find(ctx context.Context, m multihash.Multihash) (*model.FindResponse, error)

Find looks up content entries by multihash.

func (*Client) FindBatch

func (c *Client) FindBatch(ctx context.Context, mhs []multihash.Multihash) (*model.FindResponse, error)

FindBatch looks up content entries for a batch of multihashes

func (*Client) GetProvider

func (c *Client) GetProvider(ctx context.Context, providerID peer.ID) (*model.ProviderInfo, error)

func (*Client) GetStats

func (c *Client) GetStats(ctx context.Context) (*model.Stats, error)

func (*Client) ListProviders

func (c *Client) ListProviders(ctx context.Context) ([]*model.ProviderInfo, error)

type DHashClient

type DHashClient struct {
	Client
	// contains filtered or unexported fields
}

func NewDHashClient

func NewDHashClient(dhstoreURL, stiURL string, options ...Option) (*DHashClient, error)

NewDHashClient instantiates a new client that uses Reader Privacy API for querying data. It requires more roundtrips to fullfill one query however it also protects the user from a passive observer. dhstoreURL specifies the URL of the double hashed store that can respond to find encrypted multihash and find encrypted metadata requests. stiURL specifies the URL of indexer that can respond to find provider requests. dhstoreURL and stiURL are expected to be the same when these services are deployed behing a proxy - indexstar.

func (*DHashClient) Find

func (c *DHashClient) Find(ctx context.Context, mh multihash.Multihash) (*model.FindResponse, error)

type Option

type Option func(*config) error

Option is a function that sets a value in a config.

func WithClient

func WithClient(c *http.Client) Option

WithClient allows creation of the http client using an underlying network round tripper / client.

Jump to

Keyboard shortcuts

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