client

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0, MIT Imports: 30 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,
	}
)
View Source
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

func New

func New(baseURL string, opts ...Option) (*client, error)

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.

Types

type HTTPError

type HTTPError struct {
	StatusCode int
	Body       string
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type Option added in v0.9.0

type Option func(*client)

func WithHTTPClient

func WithHTTPClient(h httpClient) Option

func WithIdentity

func WithIdentity(identity crypto.PrivKey) Option

func WithProviderInfo

func WithProviderInfo(peerID peer.ID, addrs []multiaddr.Multiaddr) Option

func WithStreamResultsRequired added in v0.9.0

func WithStreamResultsRequired() Option

func WithUserAgent

func WithUserAgent(ua string) Option

type ResponseBodyLimitedTransport

type ResponseBodyLimitedTransport struct {
	http.RoundTripper
	LimitBytes int64
	UserAgent  string
}

func (*ResponseBodyLimitedTransport) RoundTrip

Jump to

Keyboard shortcuts

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