client

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) (*http.Client, error)

New initializes the HTTP2 transport with exponential backoff and returns the HTTP client for it, or returns any error occurred.

Types

type Option

type Option func(*transport) error

Option represent the functional option for transport.

func WithBackoffOpts

func WithBackoffOpts(opts ...backoff.Option) Option

WithBackoffOpts returns the option to set the options to initialize backoff.

func WithDialContext

func WithDialContext(dx func(ctx context.Context, network, addr string) (net.Conn, error)) Option

WithDialContext returns the option to set the dial context.

func WithEnableCompression

func WithEnableCompression(enable bool) Option

WithEnableCompression returns the option to enable compression.

func WithEnableKeepalives added in v1.3.1

func WithEnableKeepalives(enable bool) Option

WithEnableKeepalives returns the option to enable keep alive.

func WithExpectContinueTimeout

func WithExpectContinueTimeout(dur string) Option

WithExpectContinueTimeout returns the option to set the expect continue timeout.

func WithForceAttemptHTTP2

func WithForceAttemptHTTP2(force bool) Option

WithForceAttemptHTTP2 returns the option to force attempt HTTP2 for the HTTP transport.

func WithIdleConnTimeout

func WithIdleConnTimeout(dur string) Option

WithIdleConnTimeout returns the option to set the idle connection timeout.

func WithMaxConnsPerHost

func WithMaxConnsPerHost(cn int) Option

WithMaxConnsPerHost returns the option to set the max connections per host.

func WithMaxIdleConns

func WithMaxIdleConns(cn int) Option

WithMaxIdleConns returns the option to set the max idle connection.

func WithMaxIdleConnsPerHost

func WithMaxIdleConnsPerHost(cn int) Option

WithMaxIdleConnsPerHost returns the option to set the max idle connection per host.

func WithMaxResponseHeaderBytes

func WithMaxResponseHeaderBytes(bs int64) Option

WithMaxResponseHeaderBytes returns the option to set the max response header bytes.

func WithProxy

func WithProxy(px func(*http.Request) (*url.URL, error)) Option

WithProxy returns the option to set the transport proxy.

func WithProxyConnectHeader

func WithProxyConnectHeader(header http.Header) Option

WithProxyConnectHeader returns the option to set the proxy connect header.

func WithReadBufferSize

func WithReadBufferSize(bs int64) Option

WithReadBufferSize returns the option to set the read buffer size.

func WithResponseHeaderTimeout

func WithResponseHeaderTimeout(dur string) Option

WithResponseHeaderTimeout returns the option to set the response header timeout.

func WithTLSHandshakeTimeout

func WithTLSHandshakeTimeout(dur string) Option

WithTLSHandshakeTimeout returns the option to set the TLS handshake timeout.

func WithWriteBufferSize

func WithWriteBufferSize(bs int64) Option

WithWriteBufferSize returns the option to set the write buffer size.

Jump to

Keyboard shortcuts

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