httpx

package
v0.0.0-...-5655933 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NoProxyIgnoredWarningMap map containing URL's who will ignore the proxy in the future
	NoProxyIgnoredWarningMap = make(map[string]bool)

	// NoProxyUsedInFuture map containing URL's that will use a proxy in the future
	NoProxyUsedInFuture = make(map[string]bool)

	// NoProxyChanged map containing URL's whos proxy behavior will change in the future
	NoProxyChanged = make(map[string]bool)

	// NoProxyMapMutex Lock for all no proxy maps
	NoProxyMapMutex = sync.Mutex{}
)

Functions

func CreateHTTPClient

func CreateHTTPClient(opts ...Option) *http.Client

func CreateHTTPTransport

func CreateHTTPTransport() *http.Transport

CreateHTTPTransport creates an *http.Transport for use in the agent

func GetProxyFunc

func GetProxyFunc(httpProxy string) func(*http.Request) (*url.URL, error)

Types

type Option

type Option func(client *http.Client)

func DisableKeepAlives

func DisableKeepAlives(disableKeepAlives bool) Option

func FollowRedirects

func FollowRedirects(followRedirects bool) Option

func NetDialer

func NetDialer(dialer *net.Dialer) Option

func Proxy

func Proxy(proxy func(r *http.Request) (*url.URL, error)) Option

func Timeout

func Timeout(timeout time.Duration) Option

func TlsConfig

func TlsConfig(tlsCfg *tls.Config) Option

type ResetClient

type ResetClient struct {
	// contains filtered or unexported fields
}

ResetClient wraps (http.Client).Do and resets the underlying connections at the configured interval

func NewResetClient

func NewResetClient(resetInterval time.Duration, httpClientFactory func() *http.Client) *ResetClient

NewResetClient returns an initialized Client resetting connections at the passed resetInterval ("0" means that no reset is performed). The underlying http.Client used will be created using the passed http client factory.

func (*ResetClient) Do

func (c *ResetClient) Do(req *http.Request) (*http.Response, error)

Do wraps (http.Client).Do. Thread safe.

Jump to

Keyboard shortcuts

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