httpcli

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorParamEmpty liberr.CodeError = iota + liberr.MinPkgHttpCli
	ErrorParamInvalid
	ErrorValidatorError
	ErrorClientTransportHttp2
)
View Source
const (
	ClientTimeout5Sec = 5 * time.Second
)

Variables

This section is empty.

Functions

func DefaultConfig added in v1.10.0

func DefaultConfig(indent string) []byte

func DefaultDNSMapper added in v1.13.10

func DefaultDNSMapper() htcdns.DNSMapper

func GetClient

func GetClient() *http.Client

func SetDefaultDNSMapper added in v1.13.10

func SetDefaultDNSMapper(d htcdns.DNSMapper)

Types

type FctHttpClient added in v1.10.0

type FctHttpClient func() *http.Client

type FctHttpClientSrv added in v1.13.10

type FctHttpClientSrv func(servername string) *http.Client

type HttpClient added in v1.13.7

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type OptionForceIP added in v1.9.0

type OptionForceIP struct {
	Enable bool                   `json:"enable" yaml:"enable" toml:"enable" mapstructure:"enable"`
	Net    libptc.NetworkProtocol `json:"net,omitempty" yaml:"net,omitempty" toml:"net,omitempty" mapstructure:"net,omitempty"`
	IP     string                 `json:"ip,omitempty" yaml:"ip,omitempty" toml:"ip,omitempty" mapstructure:"ip,omitempty"`
	Local  string                 `json:"local,omitempty" yaml:"local,omitempty" toml:"local,omitempty" mapstructure:"local,omitempty"`
}

type OptionProxy added in v1.11.3

type OptionProxy struct {
	Enable   bool     `json:"enable" yaml:"enable" toml:"enable" mapstructure:"enable"`
	Endpoint *url.URL `json:"endpoint" yaml:"endpoint" toml:"endpoint" mapstructure:"endpoint"`
	Username string   `json:"username" yaml:"username" toml:"username" mapstructure:"username"`
	Password string   `json:"password" yaml:"password" toml:"password" mapstructure:"password"`
}

type OptionTLS added in v1.9.0

type OptionTLS struct {
	Enable bool          `json:"enable" yaml:"enable" toml:"enable" mapstructure:"enable"`
	Config libtls.Config `json:"tls" yaml:"tls" toml:"tls" mapstructure:"tls"`
}

type Options added in v1.9.0

type Options struct {
	Timeout            time.Duration `json:"timeout" yaml:"timeout" toml:"timeout" mapstructure:"timeout"`
	DisableKeepAlive   bool          `json:"disable-keep-alive" yaml:"disable-keep-alive" toml:"disable-keep-alive" mapstructure:"disable-keep-alive"`
	DisableCompression bool          `json:"disable-compression" yaml:"disable-compression" toml:"disable-compression" mapstructure:"disable-compression"`
	Http2              bool          `json:"http2" yaml:"http2" toml:"http2" mapstructure:"http2"`
	TLS                OptionTLS     `json:"tls" yaml:"tls" toml:"tls" mapstructure:"tls"`
	ForceIP            OptionForceIP `json:"force_ip" yaml:"force_ip" toml:"force_ip" mapstructure:"force_ip"`
	Proxy              OptionProxy   `json:"proxy" yaml:"proxy" toml:"proxy" mapstructure:"proxy"`
}

func (Options) GetClient added in v1.9.0

func (o Options) GetClient(def libtls.TLSConfig, servername string) (*http.Client, liberr.Error)

func (Options) Validate added in v1.9.0

func (o Options) Validate() liberr.Error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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