Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) FindPeers(ctx context.Context, pid peer.ID) (peers iter.ResultIter[*types.PeerRecord], err error)
- func (c *Client) FindProviders(ctx context.Context, key cid.Cid) (providers iter.ResultIter[types.Record], err error)
- func (c *Client) GetIPNS(ctx context.Context, name ipns.Name) (*ipns.Record, error)
- func (c *Client) ProvideBitswap(ctx context.Context, keys []cid.Cid, ttl time.Duration) (time.Duration, error)deprecated
- func (c *Client) PutIPNS(ctx context.Context, name ipns.Name, record *ipns.Record) error
- type HTTPError
- type Option
- type ResponseBodyLimitedTransport
Constants ¶
This section is empty.
Variables ¶
var ( ViewLatency = &view.View{ Measure: measureLatency, Aggregation: distMS, TagKeys: []tag.Key{keyOperation, keyHost, keyStatusCode, keyError}, } ViewLength = &view.View{ Measure: measureLength, Aggregation: distLength, TagKeys: []tag.Key{keyOperation, keyHost}, } OpenCensusViews = []*view.View{ ViewLatency, ViewLength, } )
var ImportPath = importPath()
ImportPath is the canonical import path that allows us to identify official client builds vs modified forks, and use that info in User-Agent header.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.16.0
type Client struct {
// contains filtered or unexported fields
}
func New ¶
New creates a content routing API client. The Provider and identity parameters are option. If they are nil, the client.ProvideBitswap method will not function.
func (*Client) FindPeers ¶ added in v0.16.0
func (c *Client) FindPeers(ctx context.Context, pid peer.ID) (peers iter.ResultIter[*types.PeerRecord], err error)
FindPeers searches for information for the given peer.ID.
func (*Client) FindProviders ¶ added in v0.16.0
func (c *Client) FindProviders(ctx context.Context, key cid.Cid) (providers iter.ResultIter[types.Record], err error)
FindProviders searches for providers that are able to provide the given cid.Cid. In a more generic way, it is also used as a mapping between CIDs and relevant metadata.
func (*Client) GetIPNS ¶ added in v0.16.0
GetIPNS tries to retrieve the ipns.Record for the given ipns.Name. The record is validated against the given name. If validation fails, an error is returned, but no record.
type Option ¶
type Option func(*Client)
func WithHTTPClient ¶
func WithHTTPClient(h httpClient) Option
func WithIdentity ¶
func WithProviderInfo ¶
func WithStreamResultsRequired ¶
func WithStreamResultsRequired() Option
func WithUserAgent ¶
type ResponseBodyLimitedTransport ¶
type ResponseBodyLimitedTransport struct { http.RoundTripper LimitBytes int64 UserAgent string }