Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultBackoff ¶ added in v0.2.0
DefaultBackoff 默认退避策略
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client HTTP 客户端封装
func NewClient ¶
func NewClient(cfg ClientConfig) (*Client, error)
NewClient 创建 HTTP 客户端(带 TLS 指纹伪装)
type ClientConfig ¶
type ClientConfig struct {
UserAgent string
ExtraHeaders map[string]string
Timeout time.Duration
MaxRedirects int
ProxyURL string // 显式代理地址,优先级最高
UseSystemProxy bool // 是否自动使用系统代理(环境变量 HTTP_PROXY/HTTPS_PROXY)
MaxRetries int // 最大重试次数,默认 3
RetryBackoffMin time.Duration // 重试最小退避,默认 1s
RetryBackoffMax time.Duration // 重试最大退避,默认 5s
}
ClientConfig HTTP 客户端配置
Click to show internal directories.
Click to hide internal directories.