client

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: Apache-2.0, MIT Imports: 32 Imported by: 0

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 `Provide` method will not function.

Types

type HTTPError

type HTTPError struct {
	StatusCode int
	Body       string
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type Option

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

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