client

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHostPoolConfig = HostPoolConfig{
	MaxConnsPerHost:     100,
	MaxIdleConnsPerHost: 20,
	IdleTimeout:         120 * time.Second,
}

Functions

func GetRandomUserAgent

func GetRandomUserAgent() string

func WarmDNS added in v1.0.9

func WarmDNS(domains []string)

Types

type ConnectionPoolManager added in v1.0.9

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

func NewConnectionPoolManager added in v1.0.9

func NewConnectionPoolManager(config HostPoolConfig) *ConnectionPoolManager

func (*ConnectionPoolManager) BuildTransport added in v1.0.9

func (cpm *ConnectionPoolManager) BuildTransport(dialer *net.Dialer, proxyFunc func(*http.Request) (*url.URL, error)) *http.Transport

func (*ConnectionPoolManager) RecordH2Multiplex added in v1.0.9

func (cpm *ConnectionPoolManager) RecordH2Multiplex(host string)

func (*ConnectionPoolManager) RecordRequest added in v1.0.9

func (cpm *ConnectionPoolManager) RecordRequest(host string, latency time.Duration, statusCode int)

func (*ConnectionPoolManager) Stats added in v1.0.9

func (cpm *ConnectionPoolManager) Stats() []HostPoolStats

type HostPoolConfig added in v1.0.9

type HostPoolConfig struct {
	MaxConnsPerHost     int
	MaxIdleConnsPerHost int
	IdleTimeout         time.Duration
}

type HostPoolStats added in v1.0.9

type HostPoolStats struct {
	Host            string
	ActiveConns     int64
	IdleConns       int64
	TotalRequests   int64
	TotalFailures   int64
	H2Multiplexed   int64
	AvgResponseTime time.Duration
}

type ProxyRotator

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

func NewHTTPClient

func NewHTTPClient(proxyStr string, timeoutSecs int) (*http.Client, *ProxyRotator, error)

func NewProxyRotator

func NewProxyRotator(proxyInput string) (*ProxyRotator, error)

func (*ProxyRotator) FilterDeadProxies added in v1.0.9

func (pr *ProxyRotator) FilterDeadProxies(timeoutSecs int) int

func (*ProxyRotator) GetProxy

func (pr *ProxyRotator) GetProxy(req *http.Request) (*url.URL, error)

func (*ProxyRotator) ReportFailure added in v1.0.9

func (pr *ProxyRotator) ReportFailure(pxy *url.URL)

type RateLimiterManager added in v1.0.9

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

func NewRateLimiterManager added in v1.0.9

func NewRateLimiterManager(r rate.Limit, b int) *RateLimiterManager

func (*RateLimiterManager) ReportResult added in v1.0.9

func (rm *RateLimiterManager) ReportResult(provider string, statusCode int)

func (*RateLimiterManager) SetLimit added in v1.0.9

func (rm *RateLimiterManager) SetLimit(provider string, r rate.Limit, b int)

func (*RateLimiterManager) Stats added in v1.0.9

func (rm *RateLimiterManager) Stats() map[string]struct {
	Requests int64
	Rate429s int64
	Limit    float64
}

func (*RateLimiterManager) Wait added in v1.0.9

func (rm *RateLimiterManager) Wait(ctx context.Context, provider string) error

type ValidationCache added in v1.0.9

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

func NewValidationCache added in v1.0.9

func NewValidationCache(ttl time.Duration, maxSize int) *ValidationCache

func (*ValidationCache) Get added in v1.0.9

func (c *ValidationCache) Get(provider, apiKey string) (*models.ValidationResult, bool)

func (*ValidationCache) Set added in v1.0.9

func (c *ValidationCache) Set(provider, apiKey string, result *models.ValidationResult)

func (*ValidationCache) Stats added in v1.0.9

func (c *ValidationCache) Stats() (hits, misses, size int)

Jump to

Keyboard shortcuts

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