Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

func NewClient

func NewClient(ctx context.Context) *http.Client

NewClient returns a new http client with default options.

func NewClientWithConfigPath

func NewClientWithConfigPath(ctx context.Context, path string) (*http.Client, error)

NewClientWithConfigPath returns a http client with options from config path.

func NewClientWithOptions

func NewClientWithOptions(ctx context.Context, options *Options) *http.Client

NewClientWithOptions returns a new http client with options.

Types

type Options

type Options struct {
	MaxIdleConnPerHost    int
	MaxIdleConn           int
	MaxConnsPerHost       int
	IdleConnTimeout       time.Duration
	DisableKeepAlives     bool
	DisableCompression    bool
	ForceHTTP2            bool          `config:"forceHTTP2"`
	TLSHandshakeTimeout   time.Duration `config:"TLSHandshakeTimeout"`
	Timeout               time.Duration
	KeepAlive             time.Duration
	ExpectContinueTimeout time.Duration
	DualStack             bool
	DialTimeout           time.Duration
}

Options http client options

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals a given key path into options and returns it.

Jump to

Keyboard shortcuts

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