dns_mapper

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorParamEmpty liberr.CodeError = iota + liberr.MinPkgHttpCliDNSMapper
	ErrorParamInvalid
	ErrorValidatorError
	ErrorClientTransportHttp2
)

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig(indent string) []byte

Types

type Config

type Config struct {
	DNSMapper  map[string]string `json:"dns-mapper,omitempty" yaml:"dns-mapper,omitempty" toml:"dns-mapper,omitempty" mapstructure:"dns-mapper,omitempty"`
	TimerClean libdur.Duration   `json:"timer-clean,omitempty" yaml:"timer-clean,omitempty" toml:"timer-clean,omitempty" mapstructure:"timer-clean,omitempty"`
	Transport  TransportConfig   `json:"transport,omitempty" yaml:"transport,omitempty" toml:"transport,omitempty" mapstructure:"transport,omitempty"`
}

func (Config) New

func (Config) Validate

func (o Config) Validate() liberr.Error

type DNSMapper

type DNSMapper interface {
	Add(from, to string)
	Get(from string) string
	Del(from string)
	Len() int
	Walk(func(from, to string) bool)
	Clean(endpoint string) (host string, port string, err error)
	Search(endpoint string) (string, error)
	SearchWithCache(endpoint string) (string, error)

	DialContext(ctx context.Context, network, address string) (net.Conn, error)
	Transport(cfg TransportConfig) *http.Transport
	Client(cfg TransportConfig) *http.Client

	DefaultTransport() *http.Transport
	DefaultClient() *http.Client

	TimeCleaner(ctx context.Context, dur time.Duration)
}

func New

func New(ctx context.Context, cfg *Config, fct libtls.FctRootCA, msg FuncMessage) DNSMapper

type FuncMessage added in v1.13.12

type FuncMessage func(msg string)

type TransportConfig

type TransportConfig struct {
	Proxy     *url.URL       `json:"proxy,omitempty" yaml:"proxy,omitempty" toml:"proxy,omitempty" mapstructure:"proxy,omitempty"`
	TLSConfig *libtls.Config `json:"tls-config,omitempty" yaml:"tls-config,omitempty" toml:"tls-config,omitempty" mapstructure:"tls-config,omitempty"`

	DisableHTTP2       bool `json:"disable-http2" yaml:"disable-http2" toml:"disable-http2" mapstructure:"disable-http2"`
	DisableKeepAlive   bool `json:"disable-keepalive" yaml:"disable-keepalive" toml:"disable-keepalive" mapstructure:"disable-keepalive"`
	DisableCompression bool `json:"disable-compression" yaml:"disable-compression" toml:"disable-compression" mapstructure:"disable-compression"`

	MaxIdleConns        int `json:"max-idle-conns" yaml:"max-idle-conns" toml:"max-idle-conns" mapstructure:"max-idle-conns"`
	MaxIdleConnsPerHost int `` /* 131-byte string literal not displayed */
	MaxConnsPerHost     int `json:"max-conns-per-host" yaml:"max-conns-per-host" toml:"max-conns-per-host" mapstructure:"max-conns-per-host"`

	TimeoutGlobal         libdur.Duration `` /* 135-byte string literal not displayed */
	TimeoutKeepAlive      libdur.Duration `` /* 127-byte string literal not displayed */
	TimeoutTLSHandshake   libdur.Duration `` /* 163-byte string literal not displayed */
	TimeoutExpectContinue libdur.Duration `` /* 171-byte string literal not displayed */
	TimeoutIdleConn       libdur.Duration `` /* 147-byte string literal not displayed */
	TimeoutResponseHeader libdur.Duration `` /* 172-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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