config

package
v0.1.63 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause Imports: 7 Imported by: 11

Documentation

Index

Constants

View Source
const (
	DefaultTimeout                        = 120 * time.Second
	DefaultRetries                        = 0
	DefaultIgnoreSSLVerification          = false
	DefaultIgnoreContentTypeForGetRequest = false
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DialContext added in v0.0.71

type DialContext func(ctx context.Context, network string, addr string) (net.Conn, error)

type HttpConfig

type HttpConfig struct {
	DialContext           DialContext
	Timeout               time.Duration
	Retries               int
	HttpProxy             *Proxy
	IgnoreSSLVerification bool
	// AllowRedirects Experimental configuration, the default value is false.
	// Automatic redirection is allowed when turns on, which may cause some request exceptions.
	AllowRedirects bool
	HttpHandler    *httphandler.HttpHandler
	// HttpTransport This configuration has the highest priority,
	// which means specifying the HttpTransport will invalidate other configurations,
	// such as DialContext, HttpProxy, IgnoreSSLVerification.
	HttpTransport *http.Transport
	// IgnoreContentTypeForGetRequest Ignore the request header Content-Type when sending a GET request,
	// the default value is false
	IgnoreContentTypeForGetRequest bool
	SigningAlgorithm               algorithm.SigningAlgorithm
}

func DefaultHttpConfig

func DefaultHttpConfig() *HttpConfig

func (*HttpConfig) WithAllowRedirects added in v0.1.42

func (config *HttpConfig) WithAllowRedirects(allowRedirects bool) *HttpConfig

WithAllowRedirects Experimental configuration, the default value is false. Automatic redirection is allowed when turns on, which may cause some request exceptions.

func (*HttpConfig) WithDialContext added in v0.0.71

func (config *HttpConfig) WithDialContext(dial DialContext) *HttpConfig

func (*HttpConfig) WithHttpHandler

func (config *HttpConfig) WithHttpHandler(handler *httphandler.HttpHandler) *HttpConfig

func (*HttpConfig) WithHttpTransport added in v0.1.43

func (config *HttpConfig) WithHttpTransport(transport *http.Transport) *HttpConfig

WithHttpTransport This configuration has the highest priority, which means specifying the HttpTransport will invalidate other configurations, such as DialContext, HttpProxy, IgnoreSSLVerification.

func (*HttpConfig) WithIgnoreContentTypeForGetRequest added in v0.1.52

func (config *HttpConfig) WithIgnoreContentTypeForGetRequest(ignoreContentTypeForGetRequest bool) *HttpConfig

WithIgnoreContentTypeForGetRequest Ignore the request header Content-Type when sending a GET request, the default value is false

func (*HttpConfig) WithIgnoreSSLVerification

func (config *HttpConfig) WithIgnoreSSLVerification(ignore bool) *HttpConfig

func (*HttpConfig) WithProxy

func (config *HttpConfig) WithProxy(proxy *Proxy) *HttpConfig

func (*HttpConfig) WithRetries

func (config *HttpConfig) WithRetries(retries int) *HttpConfig

func (*HttpConfig) WithSigningAlgorithm added in v0.1.61

func (config *HttpConfig) WithSigningAlgorithm(signingAlgorithm algorithm.SigningAlgorithm) *HttpConfig

func (*HttpConfig) WithTimeout

func (config *HttpConfig) WithTimeout(timeout time.Duration) *HttpConfig

type Proxy

type Proxy struct {
	Schema   string
	Host     string
	Port     int
	Username string
	Password string
}

func NewProxy

func NewProxy() *Proxy

func (*Proxy) GetProxyUrl

func (p *Proxy) GetProxyUrl() string

func (*Proxy) WithHost

func (p *Proxy) WithHost(host string) *Proxy

func (*Proxy) WithPassword

func (p *Proxy) WithPassword(pwd string) *Proxy

func (*Proxy) WithPort

func (p *Proxy) WithPort(port int) *Proxy

func (*Proxy) WithSchema

func (p *Proxy) WithSchema(schema string) *Proxy

func (*Proxy) WithUsername

func (p *Proxy) WithUsername(name string) *Proxy

Jump to

Keyboard shortcuts

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