httpclient

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BrowserUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"

BrowserUserAgent is the User-Agent string used across the codebase for requests to target websites. Centralised here to prevent version drift.

View Source
const DefaultTimeout = 30 * time.Second

Default timeout applied when Options.Timeout is zero.

Variables

View Source
var DefaultProfile = profiles.Chrome_146

DefaultProfile is the browser TLS+HTTP/2 fingerprint used by stealth clients.

Functions

func New

func New(opts Options) *http.Client

New creates a plain *http.Client (no TLS fingerprinting). Use for internal API calls (LLM, cache) where fingerprinting is unnecessary.

Types

type Doer

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

Doer is the minimal interface for executing HTTP requests. Both *http.Client and *tlsClientAdapter satisfy this.

func MustNewStealth

func MustNewStealth(opts Options) Doer

MustNewStealth is like NewStealth but panics on error (use in init paths).

func NewStealth

func NewStealth(opts Options) (Doer, error)

NewStealth creates a Doer with browser TLS+HTTP/2 fingerprinting. Use for outbound requests to target websites where anti-bot detection may inspect TLS ClientHello and HTTP/2 SETTINGS frames.

func NewStealthOrFallback

func NewStealthOrFallback(opts Options) Doer

NewStealthOrFallback tries to create a stealth client; falls back to plain *http.Client on failure. Useful when fingerprinting is best-effort.

func NewStealthWithRedirects

func NewStealthWithRedirects(opts Options, maxRedirects int) (Doer, error)

NewStealthWithRedirects creates a stealth Doer that follows redirects. tls-client is configured with WithNotFollowRedirects so we handle it ourselves to keep the adapter's *http.Response.Request accurate.

type Options

type Options struct {
	ProxyURL string
	Insecure bool
	Timeout  time.Duration
	WithJar  bool // attach a cookie jar (needed for clearance bootstrap)
}

Options configures the HTTP client built by New or NewStealth.

Jump to

Keyboard shortcuts

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