refreshingclient

package
v2.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRefreshableTransport

func NewRefreshableTransport(ctx context.Context, p RefreshableTransportParams, tlsConfig *tls.Config, dialer ContextDialer) http.RoundTripper

Types

type ContextDialer

type ContextDialer interface {
	DialContext(ctx context.Context, network, address string) (net.Conn, error)
}

ContextDialer is the interface implemented by net.Dialer, proxy.Dialer, and others

type DialerParams

type DialerParams struct {
	DialTimeout   time.Duration
	KeepAlive     time.Duration
	SocksProxyURL *url.URL
}

type RefreshableDialer

type RefreshableDialer struct {
	refreshable.Refreshable // contains ContextDialer
}

func (*RefreshableDialer) DialContext

func (r *RefreshableDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type RefreshableDialerParams

type RefreshableDialerParams interface {
	refreshable.Refreshable
	CurrentDialerParams() DialerParams
	MapDialerParams(func(DialerParams) interface{}) refreshable.Refreshable
	SubscribeToDialerParams(func(DialerParams)) (unsubscribe func())

	DialTimeout() refreshable.Duration
	KeepAlive() refreshable.Duration
	SocksProxyURL() RefreshableURLPtr
}

func ConfigureDialer

ConfigureDialer accepts a mapping function which will be applied to the params value as it is evaluated. This can be used to layer/overwrite configuration before building the RefreshableDialer.

type RefreshableHTTPClient

type RefreshableHTTPClient interface {
	refreshable.Refreshable
	CurrentHTTPClient() *http.Client
}

func NewRefreshableHTTPClient

func NewRefreshableHTTPClient(rt http.RoundTripper, timeout refreshable.Duration) RefreshableHTTPClient

type RefreshableRetryParams

type RefreshableRetryParams interface {
	refreshable.Refreshable
	CurrentRetryParams() RetryParams
	MapRetryParams(func(RetryParams) interface{}) refreshable.Refreshable
	SubscribeToRetryParams(func(RetryParams)) (unsubscribe func())

	InitialBackoff() refreshable.Duration
	MaxBackoff() refreshable.Duration
}

func ConfigureRetry

ConfigureRetry accepts a mapping function which will be applied to the params value as it is evaluated. This can be used to layer/overwrite configuration before building the RefreshableRetryParams.

type RefreshableTag

type RefreshableTag interface {
	refreshable.Refreshable
	CurrentTag() metrics.Tag
	MapTag(func(metrics.Tag) interface{}) refreshable.Refreshable
	SubscribeToTag(func(metrics.Tag)) (unsubscribe func())
}

type RefreshableTagSlice

type RefreshableTagSlice interface {
	refreshable.Refreshable
	CurrentTagSlice() []metrics.Tag
	MapTagSlice(func([]metrics.Tag) interface{}) refreshable.Refreshable
	SubscribeToTagSlice(func([]metrics.Tag)) (unsubscribe func())
}

type RefreshableTags

type RefreshableTags interface {
	refreshable.Refreshable
	CurrentTags() metrics.Tags
	MapTags(func(metrics.Tags) interface{}) refreshable.Refreshable
	SubscribeToTags(func(metrics.Tags)) (unsubscribe func())
}

type RefreshableTransport

type RefreshableTransport struct {
	refreshable.Refreshable // contains *http.Transport
}

RefreshableTransport implements http.RoundTripper backed by a refreshable *http.Transport. The transport and internal dialer are each rebuilt when any of their respective parameters are updated.

func (RefreshableTransport) RoundTrip

func (r RefreshableTransport) RoundTrip(req *http.Request) (*http.Response, error)

type RefreshableTransportParams

type RefreshableTransportParams interface {
	refreshable.Refreshable
	CurrentTransportParams() TransportParams
	MapTransportParams(func(TransportParams) interface{}) refreshable.Refreshable
	SubscribeToTransportParams(func(TransportParams)) (unsubscribe func())

	MaxIdleConns() refreshable.Int
	MaxIdleConnsPerHost() refreshable.Int
	DisableHTTP2() refreshable.Bool
	DisableKeepAlives() refreshable.Bool
	IdleConnTimeout() refreshable.Duration
	ExpectContinueTimeout() refreshable.Duration
	ResponseHeaderTimeout() refreshable.Duration
	TLSHandshakeTimeout() refreshable.Duration
	HTTPProxyURL() RefreshableURLPtr
	ProxyFromEnvironment() refreshable.Bool
	HTTP2ReadIdleTimeout() refreshable.Duration
	HTTP2PingTimeout() refreshable.Duration
}

func ConfigureTransport

ConfigureTransport accepts a mapping function which will be applied to the params value as it is evaluated. This can be used to layer/overwrite configuration before building the RefreshableTransportParams.

type RefreshableURL

type RefreshableURL interface {
	refreshable.Refreshable
	CurrentURL() url.URL
	MapURL(func(url.URL) interface{}) refreshable.Refreshable
	SubscribeToURL(func(url.URL)) (unsubscribe func())

	Scheme() refreshable.String
	Opaque() refreshable.String
	User() RefreshableUserinfoPtr
	Host() refreshable.String
	Path() refreshable.String
	RawPath() refreshable.String
	ForceQuery() refreshable.Bool
	RawQuery() refreshable.String
	Fragment() refreshable.String
	RawFragment() refreshable.String
}

type RefreshableURLPtr

type RefreshableURLPtr interface {
	refreshable.Refreshable
	CurrentURLPtr() *url.URL
	MapURLPtr(func(*url.URL) interface{}) refreshable.Refreshable
	SubscribeToURLPtr(func(*url.URL)) (unsubscribe func())

	Scheme() refreshable.String
	Opaque() refreshable.String
	User() RefreshableUserinfoPtr
	Host() refreshable.String
	Path() refreshable.String
	RawPath() refreshable.String
	ForceQuery() refreshable.Bool
	RawQuery() refreshable.String
	Fragment() refreshable.String
	RawFragment() refreshable.String
}

type RefreshableUserinfo

type RefreshableUserinfo interface {
	refreshable.Refreshable
	CurrentUserinfo() url.Userinfo
	MapUserinfo(func(url.Userinfo) interface{}) refreshable.Refreshable
	SubscribeToUserinfo(func(url.Userinfo)) (unsubscribe func())
}

type RefreshableUserinfoPtr

type RefreshableUserinfoPtr interface {
	refreshable.Refreshable
	CurrentUserinfoPtr() *url.Userinfo
	MapUserinfoPtr(func(*url.Userinfo) interface{}) refreshable.Refreshable
	SubscribeToUserinfoPtr(func(*url.Userinfo)) (unsubscribe func())
}

type RefreshableValidatedClientParams

type RefreshableValidatedClientParams interface {
	refreshable.Refreshable
	CurrentValidatedClientParams() ValidatedClientParams
	MapValidatedClientParams(func(ValidatedClientParams) interface{}) refreshable.Refreshable
	SubscribeToValidatedClientParams(func(ValidatedClientParams)) (unsubscribe func())

	APIToken() refreshable.StringPtr
	Dialer() RefreshableDialerParams
	DisableMetrics() refreshable.Bool
	MaxAttempts() refreshable.IntPtr
	MetricsTags() RefreshableTags
	Retry() RefreshableRetryParams
	Timeout() refreshable.Duration
	Transport() RefreshableTransportParams
	URIs() refreshable.StringSlice
}

type RefreshingDialerParams

type RefreshingDialerParams struct {
	refreshable.Refreshable
}

func (RefreshingDialerParams) CurrentDialerParams

func (r RefreshingDialerParams) CurrentDialerParams() DialerParams

func (RefreshingDialerParams) DialTimeout

func (RefreshingDialerParams) KeepAlive

func (RefreshingDialerParams) MapDialerParams

func (r RefreshingDialerParams) MapDialerParams(mapFn func(DialerParams) interface{}) refreshable.Refreshable

func (RefreshingDialerParams) SocksProxyURL

func (r RefreshingDialerParams) SocksProxyURL() RefreshableURLPtr

func (RefreshingDialerParams) SubscribeToDialerParams

func (r RefreshingDialerParams) SubscribeToDialerParams(consumer func(DialerParams)) (unsubscribe func())

type RefreshingRetryParams

type RefreshingRetryParams struct {
	refreshable.Refreshable
}

func (RefreshingRetryParams) CurrentRetryParams

func (r RefreshingRetryParams) CurrentRetryParams() RetryParams

func (RefreshingRetryParams) InitialBackoff

func (r RefreshingRetryParams) InitialBackoff() refreshable.Duration

func (RefreshingRetryParams) MapRetryParams

func (r RefreshingRetryParams) MapRetryParams(mapFn func(RetryParams) interface{}) refreshable.Refreshable

func (RefreshingRetryParams) MaxBackoff

func (RefreshingRetryParams) SubscribeToRetryParams

func (r RefreshingRetryParams) SubscribeToRetryParams(consumer func(RetryParams)) (unsubscribe func())

type RefreshingTag

type RefreshingTag struct {
	refreshable.Refreshable
}

func NewRefreshingTag

func NewRefreshingTag(in refreshable.Refreshable) RefreshingTag

func (RefreshingTag) CurrentTag

func (r RefreshingTag) CurrentTag() metrics.Tag

func (RefreshingTag) MapTag

func (r RefreshingTag) MapTag(mapFn func(metrics.Tag) interface{}) refreshable.Refreshable

func (RefreshingTag) SubscribeToTag

func (r RefreshingTag) SubscribeToTag(consumer func(metrics.Tag)) (unsubscribe func())

type RefreshingTagSlice

type RefreshingTagSlice struct {
	refreshable.Refreshable
}

func NewRefreshingTagSlice

func NewRefreshingTagSlice(in refreshable.Refreshable) RefreshingTagSlice

func (RefreshingTagSlice) CurrentTagSlice

func (r RefreshingTagSlice) CurrentTagSlice() []metrics.Tag

func (RefreshingTagSlice) MapTagSlice

func (r RefreshingTagSlice) MapTagSlice(mapFn func([]metrics.Tag) interface{}) refreshable.Refreshable

func (RefreshingTagSlice) SubscribeToTagSlice

func (r RefreshingTagSlice) SubscribeToTagSlice(consumer func([]metrics.Tag)) (unsubscribe func())

type RefreshingTags

type RefreshingTags struct {
	refreshable.Refreshable
}

func NewRefreshingTags

func NewRefreshingTags(in refreshable.Refreshable) RefreshingTags

func (RefreshingTags) CurrentTags

func (r RefreshingTags) CurrentTags() metrics.Tags

func (RefreshingTags) MapTags

func (r RefreshingTags) MapTags(mapFn func(metrics.Tags) interface{}) refreshable.Refreshable

func (RefreshingTags) SubscribeToTags

func (r RefreshingTags) SubscribeToTags(consumer func(metrics.Tags)) (unsubscribe func())

type RefreshingTransportParams

type RefreshingTransportParams struct {
	refreshable.Refreshable
}

func (RefreshingTransportParams) CurrentTransportParams

func (r RefreshingTransportParams) CurrentTransportParams() TransportParams

func (RefreshingTransportParams) DisableHTTP2

func (r RefreshingTransportParams) DisableHTTP2() refreshable.Bool

func (RefreshingTransportParams) DisableKeepAlives

func (r RefreshingTransportParams) DisableKeepAlives() refreshable.Bool

func (RefreshingTransportParams) ExpectContinueTimeout

func (r RefreshingTransportParams) ExpectContinueTimeout() refreshable.Duration

func (RefreshingTransportParams) HTTP2PingTimeout

func (r RefreshingTransportParams) HTTP2PingTimeout() refreshable.Duration

func (RefreshingTransportParams) HTTP2ReadIdleTimeout

func (r RefreshingTransportParams) HTTP2ReadIdleTimeout() refreshable.Duration

func (RefreshingTransportParams) HTTPProxyURL

func (RefreshingTransportParams) IdleConnTimeout

func (r RefreshingTransportParams) IdleConnTimeout() refreshable.Duration

func (RefreshingTransportParams) MapTransportParams

func (r RefreshingTransportParams) MapTransportParams(mapFn func(TransportParams) interface{}) refreshable.Refreshable

func (RefreshingTransportParams) MaxIdleConns

func (r RefreshingTransportParams) MaxIdleConns() refreshable.Int

func (RefreshingTransportParams) MaxIdleConnsPerHost

func (r RefreshingTransportParams) MaxIdleConnsPerHost() refreshable.Int

func (RefreshingTransportParams) ProxyFromEnvironment

func (r RefreshingTransportParams) ProxyFromEnvironment() refreshable.Bool

func (RefreshingTransportParams) ResponseHeaderTimeout

func (r RefreshingTransportParams) ResponseHeaderTimeout() refreshable.Duration

func (RefreshingTransportParams) SubscribeToTransportParams

func (r RefreshingTransportParams) SubscribeToTransportParams(consumer func(TransportParams)) (unsubscribe func())

func (RefreshingTransportParams) TLSHandshakeTimeout

func (r RefreshingTransportParams) TLSHandshakeTimeout() refreshable.Duration

type RefreshingURL

type RefreshingURL struct {
	refreshable.Refreshable
}

func NewRefreshingURL

func NewRefreshingURL(in refreshable.Refreshable) RefreshingURL

func (RefreshingURL) CurrentURL

func (r RefreshingURL) CurrentURL() url.URL

func (RefreshingURL) ForceQuery

func (r RefreshingURL) ForceQuery() refreshable.Bool

func (RefreshingURL) Fragment

func (r RefreshingURL) Fragment() refreshable.String

func (RefreshingURL) Host

func (r RefreshingURL) Host() refreshable.String

func (RefreshingURL) MapURL

func (r RefreshingURL) MapURL(mapFn func(url.URL) interface{}) refreshable.Refreshable

func (RefreshingURL) Opaque

func (r RefreshingURL) Opaque() refreshable.String

func (RefreshingURL) Path

func (r RefreshingURL) Path() refreshable.String

func (RefreshingURL) RawFragment

func (r RefreshingURL) RawFragment() refreshable.String

func (RefreshingURL) RawPath

func (r RefreshingURL) RawPath() refreshable.String

func (RefreshingURL) RawQuery

func (r RefreshingURL) RawQuery() refreshable.String

func (RefreshingURL) Scheme

func (r RefreshingURL) Scheme() refreshable.String

func (RefreshingURL) SubscribeToURL

func (r RefreshingURL) SubscribeToURL(consumer func(url.URL)) (unsubscribe func())

func (RefreshingURL) User

type RefreshingURLPtr

type RefreshingURLPtr struct {
	refreshable.Refreshable
}

func NewRefreshingURLPtr

func NewRefreshingURLPtr(in refreshable.Refreshable) RefreshingURLPtr

func (RefreshingURLPtr) CurrentURLPtr

func (r RefreshingURLPtr) CurrentURLPtr() *url.URL

func (RefreshingURLPtr) ForceQuery

func (r RefreshingURLPtr) ForceQuery() refreshable.Bool

func (RefreshingURLPtr) Fragment

func (r RefreshingURLPtr) Fragment() refreshable.String

func (RefreshingURLPtr) Host

func (RefreshingURLPtr) MapURLPtr

func (r RefreshingURLPtr) MapURLPtr(mapFn func(*url.URL) interface{}) refreshable.Refreshable

func (RefreshingURLPtr) Opaque

func (r RefreshingURLPtr) Opaque() refreshable.String

func (RefreshingURLPtr) Path

func (RefreshingURLPtr) RawFragment

func (r RefreshingURLPtr) RawFragment() refreshable.String

func (RefreshingURLPtr) RawPath

func (r RefreshingURLPtr) RawPath() refreshable.String

func (RefreshingURLPtr) RawQuery

func (r RefreshingURLPtr) RawQuery() refreshable.String

func (RefreshingURLPtr) Scheme

func (r RefreshingURLPtr) Scheme() refreshable.String

func (RefreshingURLPtr) SubscribeToURLPtr

func (r RefreshingURLPtr) SubscribeToURLPtr(consumer func(*url.URL)) (unsubscribe func())

func (RefreshingURLPtr) User

type RefreshingUserinfo

type RefreshingUserinfo struct {
	refreshable.Refreshable
}

func NewRefreshingUserinfo

func NewRefreshingUserinfo(in refreshable.Refreshable) RefreshingUserinfo

func (RefreshingUserinfo) CurrentUserinfo

func (r RefreshingUserinfo) CurrentUserinfo() url.Userinfo

func (RefreshingUserinfo) MapUserinfo

func (r RefreshingUserinfo) MapUserinfo(mapFn func(url.Userinfo) interface{}) refreshable.Refreshable

func (RefreshingUserinfo) SubscribeToUserinfo

func (r RefreshingUserinfo) SubscribeToUserinfo(consumer func(url.Userinfo)) (unsubscribe func())

type RefreshingUserinfoPtr

type RefreshingUserinfoPtr struct {
	refreshable.Refreshable
}

func (RefreshingUserinfoPtr) CurrentUserinfoPtr

func (r RefreshingUserinfoPtr) CurrentUserinfoPtr() *url.Userinfo

func (RefreshingUserinfoPtr) MapUserinfoPtr

func (r RefreshingUserinfoPtr) MapUserinfoPtr(mapFn func(*url.Userinfo) interface{}) refreshable.Refreshable

func (RefreshingUserinfoPtr) SubscribeToUserinfoPtr

func (r RefreshingUserinfoPtr) SubscribeToUserinfoPtr(consumer func(*url.Userinfo)) (unsubscribe func())

type RefreshingValidatedClientParams

type RefreshingValidatedClientParams struct {
	refreshable.Refreshable
}

func (RefreshingValidatedClientParams) APIToken

func (RefreshingValidatedClientParams) CurrentValidatedClientParams

func (r RefreshingValidatedClientParams) CurrentValidatedClientParams() ValidatedClientParams

func (RefreshingValidatedClientParams) Dialer

func (RefreshingValidatedClientParams) DisableMetrics

func (RefreshingValidatedClientParams) MapValidatedClientParams

func (r RefreshingValidatedClientParams) MapValidatedClientParams(mapFn func(ValidatedClientParams) interface{}) refreshable.Refreshable

func (RefreshingValidatedClientParams) MaxAttempts

func (RefreshingValidatedClientParams) MetricsTags

func (RefreshingValidatedClientParams) Retry

func (RefreshingValidatedClientParams) SubscribeToValidatedClientParams

func (r RefreshingValidatedClientParams) SubscribeToValidatedClientParams(consumer func(ValidatedClientParams)) (unsubscribe func())

func (RefreshingValidatedClientParams) Timeout

func (RefreshingValidatedClientParams) Transport

func (RefreshingValidatedClientParams) URIs

type RetryParams

type RetryParams struct {
	InitialBackoff time.Duration
	MaxBackoff     time.Duration
}

func (RetryParams) Start

func (r RetryParams) Start(ctx context.Context) retry.Retrier

type TransportParams

type TransportParams struct {
	MaxIdleConns          int
	MaxIdleConnsPerHost   int
	DisableHTTP2          bool
	DisableKeepAlives     bool
	IdleConnTimeout       time.Duration
	ExpectContinueTimeout time.Duration
	ResponseHeaderTimeout time.Duration
	TLSHandshakeTimeout   time.Duration
	HTTPProxyURL          *url.URL
	ProxyFromEnvironment  bool
	HTTP2ReadIdleTimeout  time.Duration
	HTTP2PingTimeout      time.Duration
}

type ValidatedClientParams

type ValidatedClientParams struct {
	APIToken       *string
	Dialer         DialerParams
	DisableMetrics bool
	MaxAttempts    *int
	MetricsTags    metrics.Tags
	Retry          RetryParams
	Timeout        time.Duration
	Transport      TransportParams
	URIs           []string
}

ValidatedClientParams represents a set of fields derived from a snapshot of ClientConfig. It is designed for use within a refreshable: fields are comparable with reflect.DeepEqual so unnecessary updates are not pushed to subscribers. Values are generally known to be "valid" to minimize downstream error handling.

Jump to

Keyboard shortcuts

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