httpflags

package
v0.0.0-...-fb49ba0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package httpflags provides HTTP client flags.

Index

Constants

This section is empty.

Variables

View Source
var Default = HTTP{
	Timeout:          10 * time.Second,
	UntrustedTimeout: 2 * time.Second,
}

Default contains the default flags. Make a copy of this, do not reuse.

Functions

This section is empty.

Types

type HTTP

type HTTP struct {
	Timeout time.Duration `long:"http-timeout" env:"HB_HTTP_TIMEOUT" description:"HTTP client timeout"`

	UntrustedTimeout       time.Duration `long:"http-untrusted-timeout" env:"HB_HTTP_UNTRUSTED_TIMEOUT" description:"Untrusted HTTP client timeout"`
	UntrustedProxy         string        `long:"http-untrusted-proxy" env:"HB_HTTP_UNTRUSTED_PROXY" description:"Untrusted HTTP client proxy address"`
	UntrustedProxyUser     string        `long:"http-untrusted-proxy-user" env:"HB_HTTP_UNTRUSTED_PROXY_USER" description:"Untrusted HTTP client proxy user"`
	UntrustedProxyPassword string        `` /* 126-byte string literal not displayed */
}

HTTP contains HTTP client flags.

func (*HTTP) Client

func (h *HTTP) Client() *http.Client

Client returns a new HTTP client configured based on the flags.

func (*HTTP) UntrustedClient

func (h *HTTP) UntrustedClient(ctx context.Context) *http.Client

UntrustedClient returns a new HTTP client which can be used for untrusted HTTP requests.

Jump to

Keyboard shortcuts

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