httpclient

package module
v0.0.0-...-695b9c6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 16 Imported by: ? modules, 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.

README

httpclient

Documentation

Index

Constants

View Source
const (
	BrowserChrome = types.BrowserChrome
	BrowserEdge   = types.BrowserEdge
)

Variables

View Source
var DefaultRetryConfig = transport.DefaultRetryConfig

DefaultRetryConfig реэкспортируем готовую конфигурацию ретраев

View Source
var NewRoundRobinProxyRotator = transport.NewRoundRobinProxyRotator

NewRoundRobinProxyRotator создает пул прокси с round-robin ротацией

View Source
var ProbeLocalBrowser = browser.ProbeLocalBrowser

ProbeLocalBrowser выносим как публичную функцию для тестов/диагностики

View Source
var WithProxy = transport.WithProxy

WithProxy прикрепляет прокси к контексту конкретного запроса

Functions

This section is empty.

Types

type BrowserInfo

type BrowserInfo = types.BrowserInfo

Реэкспорт базовых типов

type BrowserType

type BrowserType = types.BrowserType

Реэкспорт базовых типов

type BrowserVersion

type BrowserVersion = types.BrowserVersion

Реэкспорт базовых типов

type CapturedProfile

type CapturedProfile = types.CapturedProfile

Реэкспорт базовых типов

type Client

type Client struct {
	*http.Client
	Jar            tlsclient.CookieJar
	BrowserVersion types.BrowserVersion
	Profile        profiles.ClientProfile
	Rotator        transport.ProxyRotator
}

Client — обертка над http.Client с расширенными возможностями.

func New

func New(s ClientSettings) (*Client, error)

New создает готовый к работе HTTP-клиент с антидетектом и отказоустойчивой версионизацией.

func (*Client) Cookies

func (c *Client) Cookies(u *url.URL) []*http.Cookie

Cookies возвращает сохраненные куки для указанного URL в стандартном формате net/http.

func (*Client) ExportSession

func (c *Client) ExportSession(u *url.URL) ([]byte, error)

ExportSession сериализует все куки и состояние в JSON.

func (*Client) Get

func (c *Client) Get(ctx context.Context, targetURL string) (*http.Response, error)

Get выполняет быстрый GET запрос.

func (*Client) GetString

func (c *Client) GetString(ctx context.Context, targetURL string) (string, int, error)

GetString выполняет GET запрос и возвращает тело ответа в виде строки.

func (*Client) ImportSession

func (c *Client) ImportSession(u *url.URL, data []byte) error

ImportSession восстанавливает куки из сохраненного JSON.

func (*Client) PostJSON

func (c *Client) PostJSON(ctx context.Context, targetURL string, payload any) (*http.Response, error)

PostJSON отправляет POST запрос с JSON структурой.

func (*Client) SetCookies

func (c *Client) SetCookies(u *url.URL, cookies []*http.Cookie)

SetCookies сохраняет net/http куки в Jar клиента.

type ClientSettings

type ClientSettings struct {
	Timeout              time.Duration                                      // Общий таймаут на запрос (по умолчанию 30s)
	StrictSSL            bool                                               // Проверять SSL сертификаты (true = строгая проверка)
	NetMode              NetworkMode                                        // IPv4, IPv6 или Auto
	ProxyURI             string                                             // Стартовый прокси по умолчанию
	ProxyRotator         transport.ProxyRotator                             // Пул прокси для автоматической ротации
	Browser              types.BrowserType                                  // BrowserChrome или BrowserEdge
	FollowRedirects      bool                                               // Следовать ли редиректам (по умолчанию true)
	MaxRedirects         int                                                // Максимальное количество редиректов (дефолт 10)
	CheckRedirect        func(req *http.Request, via []*http.Request) error // Кастомный обработчик редиректов
	Retry                transport.RetryConfig                              // Политика повторов (или DefaultRetryConfig)
	CacheDir             string                                             // Путь для кэширования версий (по умолчанию os.TempDir())
	ProfilePath          string                                             // Путь к файлу кэша захваченного профиля (опционально)
	ProfileCacheTTL      time.Duration                                      // Время жизни кэша отпечатка (по умолчанию 7 дней)
	RemoteManifestURLs   []string                                           // Ссылки на собственные зеркала профилей (S3 / GitHub Raw)
	GitHubRepo           string                                             // Репозиторий проекта (например "imbecility/httpclient") для автоподтягивания отпечатков
	DisableLocalProbe    bool                                               // Отключить вызов локального браузера
	DisableExternalProbe bool                                               // Отключить внешние анализаторы
	CookieJar            tlsclient.CookieJar                                // Пользовательский Jar
}

ClientSettings конфигурация для инициализации клиента.

type HTTP2Fingerprint

type HTTP2Fingerprint = types.HTTP2Fingerprint

Реэкспорт базовых типов

type NetworkMode

type NetworkMode string

NetworkMode определяет предпочтительный сетевой протокол (IPv4 / IPv6).

const (
	NetworkModeAuto NetworkMode = ""
	NetworkModeIPv4 NetworkMode = "ipv4"
	NetworkModeIPv6 NetworkMode = "ipv6"
)

type ProxyRotator

type ProxyRotator = transport.ProxyRotator

Реэкспорт базовых типов

type RetryConfig

type RetryConfig = transport.RetryConfig

Реэкспорт базовых типов

type RoundRobinProxyRotator

type RoundRobinProxyRotator = transport.RoundRobinProxyRotator

Реэкспорт базовых типов

type SessionState

type SessionState struct {
	Cookies        []*http.Cookie       `json:"cookies"`
	BrowserVersion types.BrowserVersion `json:"browser_version"`
	ExportedAt     time.Time            `json:"exported_at"`
}

SessionState представляет сохраненное состояние сессии для экспорта/импорта.

type TLSFingerprint

type TLSFingerprint = types.TLSFingerprint

Реэкспорт базовых типов

Directories

Path Synopsis
cmd
capture command
internal
probes
./internal/probes/github.go
./internal/probes/github.go
profile
./internal/profile/resolver.go
./internal/profile/resolver.go
transport
./internal/transport/proxy.go
./internal/transport/proxy.go

Jump to

Keyboard shortcuts

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