config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 99

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetPreDefinedOpts

func SetPreDefinedOpts(opts ...RequestOption)

Pre define some RequestOption here

Types

type ClientOption

type ClientOption struct {
	F func(o *ClientOptions)
}

ClientOption is the only struct that can be used to set ClientOptions.

type ClientOptions

type ClientOptions struct {
	// Timeout for establishing a connection to server
	DialTimeout time.Duration
	// The max connection nums for each host
	MaxConnsPerHost int

	MaxIdleConnDuration       time.Duration
	MaxConnDuration           time.Duration
	MaxConnWaitTimeout        time.Duration
	MaxIdempotentCallAttempts int
	KeepAlive                 bool
	ReadTimeout               time.Duration
	TLSConfig                 *tls.Config
	ResponseBodyStream        bool
	DialFunc                  func(addr string) (network.Conn, error)
}

func NewClientOptions

func NewClientOptions(opts []ClientOption) *ClientOptions

func (*ClientOptions) Apply

func (o *ClientOptions) Apply(opts []ClientOption)

type Option

type Option struct {
	F func(o *Options)
}

Option is the only struct that can be used to set Options.

type Options

type Options struct {
	KeepAliveTimeout             time.Duration
	ReadTimeout                  time.Duration
	IdleTimeout                  time.Duration
	RedirectTrailingSlash        bool
	MaxRequestBodySize           int
	MaxKeepBodySize              int
	GetOnly                      bool
	DisableKeepalive             bool
	RedirectFixedPath            bool
	HandleMethodNotAllowed       bool
	UseRawPath                   bool
	RemoveExtraSlash             bool
	UnescapePathValues           bool
	DisablePreParseMultipartForm bool
	StreamRequestBody            bool
	NoDefaultServerHeader        bool
	Network                      string
	Addr                         string
	ExitWaitTimeout              time.Duration
	TLS                          *tls.Config
	H2C                          bool
	ReadBufferSize               int
	ALPN                         bool
	Tracers                      []interface{}
	TraceLevel                   interface{}
	ListenConfig                 *net.ListenConfig
}

func NewOptions

func NewOptions(opts []Option) *Options

func (*Options) Apply

func (o *Options) Apply(opts []Option)

type RequestOption

type RequestOption struct {
	F func(o *RequestOptions)
}

RequestOption 是唯一可以用来设置 RequestOption 的类.

func WithSD

func WithSD(b bool) RequestOption

WithSD set isSD in RequestOptions.

func WithTag

func WithTag(k, v string) RequestOption

WithTag set tag in RequestOptions.

type RequestOptions

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

func NewRequestOptions

func NewRequestOptions(opts []RequestOption) *RequestOptions

NewRequestOptions create a *RequestOptions according to the given opts

func (*RequestOptions) Apply

func (o *RequestOptions) Apply(opts []RequestOption)

func (*RequestOptions) CopyTo

func (o *RequestOptions) CopyTo(dst *RequestOptions)

func (*RequestOptions) IsSD

func (o *RequestOptions) IsSD() bool

func (*RequestOptions) Tag

func (o *RequestOptions) Tag(k string) string

Jump to

Keyboard shortcuts

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