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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func WithHTTPClient ¶
func WithHTTPClient(h httpClient) Option
WithHTTPClient sets a custom HTTP Client to be used with Client.
func WithIdentity ¶
func WithProviderInfo ¶
func WithStreamResultsRequired ¶
func WithStreamResultsRequired() Option
func WithUserAgent ¶
WithUserAgent sets a custom user agent to use with the HTTP Client. This modifies the underlying http.Client. Therefore, you should not use the same HTTP Client with multiple routing clients.
This only works if using a http.Client with a ResponseBodyLimitedTransport set as its transport. Otherwise, an error will be returned.
type ResponseBodyLimitedTransport ¶
type ResponseBodyLimitedTransport struct { http.RoundTripper LimitBytes int64 UserAgent string }