client

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0, MIT Imports: 28 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 `Provide` method will not function.

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 WithUserAgent

func WithUserAgent(ua string) option

Types

type HTTPError

type HTTPError struct {
	StatusCode int
	Body       string
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

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