httpcloak

package module
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 11 Imported by: 0

README ΒΆ

httpcloak

Go Reference PyPI npm NuGet

Every Byte of your Request Indistinguishable from Chrome.



The Problem

Bot detection doesn't just check your User-Agent anymore.

It fingerprints your TLS handshake. Your HTTP/2 frames. Your QUIC parameters. The order of your headers. Whether your SNI is encrypted.

One mismatch = blocked.

The Solution

import httpcloak

r = httpcloak.get("https://target.com", preset="chrome-143")

That's it. Full browser transport layer fingerprint.


What Gets Emulated

πŸ” TLS Layer

  • JA3 / JA4 fingerprints
  • GREASE randomization
  • Post-quantum X25519MLKEM768
  • ECH (Encrypted Client Hello)

πŸš€ Transport Layer

  • HTTP/2 SETTINGS frames
  • WINDOW_UPDATE values
  • Stream priorities (HPACK)
  • QUIC transport parameters
  • HTTP/3 GREASE frames

🧠 Header Layer

  • Sec-Fetch-* coherence
  • Client Hints (Sec-Ch-UA)
  • Accept / Accept-Language
  • Header ordering
  • Cookie persistence

Results

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  ECH (Encrypted Client Hello)   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  WITHOUT:  sni=plaintext        β”‚
β”‚  WITH:     sni=encrypted   +    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  HTTP/3 Fingerprint Match       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Protocol:        h3       +    β”‚
β”‚  QUIC Version:    1        +    β”‚
β”‚  Transport Params:         +    β”‚
β”‚  GREASE Frames:            +    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

vs curl_cffi

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        BOTH LIBRARIES          β”‚       HTTPCLOAK ONLY           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                β”‚                                β”‚
β”‚  + TLS fingerprint (JA3/JA4)   β”‚  + HTTP/3 fingerprinting       β”‚
β”‚  + HTTP/2 fingerprint          β”‚  + ECH (encrypted SNI)         β”‚
β”‚  + Post-quantum TLS            β”‚  + MASQUE proxy                β”‚
β”‚  + Bot score: 99               β”‚  + Domain fronting             β”‚
β”‚                                β”‚  + Certificate pinning         β”‚
β”‚                                β”‚  + Go, Python, Node.js, C#     β”‚
β”‚                                β”‚                                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Install

pip install httpcloak        # Python
npm install httpcloak        # Node.js
go get github.com/sardanioss/httpcloak   # Go
dotnet add package HttpCloak # C#

Quick Start

Python

import httpcloak

# Simple request
r = httpcloak.get("https://example.com", preset="chrome-143")
print(r.status_code, r.protocol)

# POST with JSON
r = httpcloak.post("https://httpbin.org/post",
    json={"key": "value"},
    preset="chrome-143"
)

# Custom headers
r = httpcloak.get("https://httpbin.org/headers",
    headers={"X-Custom": "value"},
    preset="chrome-143"
)

Go

import (
    "context"
    "github.com/sardanioss/httpcloak/client"
)

// Simple request
c := client.NewClient("chrome-143")
defer c.Close()

resp, _ := c.Get(ctx, "https://example.com", nil)
body, _ := resp.Text()
fmt.Println(resp.StatusCode, resp.Protocol)

// POST with JSON
jsonBody := []byte(`{"key": "value"}`)
resp, _ = c.Post(ctx, "https://httpbin.org/post",
    bytes.NewReader(jsonBody),
    map[string][]string{"Content-Type": {"application/json"}},
)

// Custom headers
resp, _ = c.Get(ctx, "https://httpbin.org/headers", map[string][]string{
    "X-Custom": {"value"},
})

Node.js

import httpcloak from "httpcloak";

// Simple request
const session = new httpcloak.Session({ preset: "chrome-143" });
const r = await session.get("https://example.com");
console.log(r.statusCode, r.protocol);

// POST with JSON
const r = await session.post("https://httpbin.org/post", {
    json: { key: "value" }
});

// Custom headers
const r = await session.get("https://httpbin.org/headers", {
    headers: { "X-Custom": "value" }
});

session.close();

C#

using HttpCloak;

// Simple request
using var session = new Session(preset: Presets.Chrome143);
var r = session.Get("https://example.com");
Console.WriteLine($"{r.StatusCode} {r.Protocol}");

// POST with JSON
var r = session.Post("https://httpbin.org/post",
    json: new { key = "value" }
);

// Custom headers
var r = session.Get("https://httpbin.org/headers",
    headers: new Dictionary<string, string> { ["X-Custom"] = "value" }
);

Features

πŸ” ECH (Encrypted Client Hello)

Hides which domain you're connecting to from network observers.

session = httpcloak.Session(
    preset="chrome-143",
    ech_from="cloudflare.com"  # Fetches ECH config from DNS
)

Cloudflare trace shows sni=encrypted instead of sni=plaintext.

🌐 HTTP/3 Through Proxies

Two methods for QUIC through proxies:

Method How it works
SOCKS5 UDP ASSOCIATE Proxy relays UDP packets. Most residential proxies support this.
MASQUE (CONNECT-UDP) RFC 9298. Tunnels UDP over HTTP/3. Premium providers only.
# SOCKS5 with UDP
session = httpcloak.Session(proxy="socks5://user:pass@proxy:1080")

# MASQUE
session = httpcloak.Session(proxy="masque://proxy:443")

Known MASQUE providers (auto-detected): Bright Data, Oxylabs, Smartproxy, SOAX.

🎭 Domain Fronting

Connect to a different host than what appears in TLS SNI.

client := httpcloak.NewClient("chrome-143",
    httpcloak.WithConnectTo("public-cdn.com", "actual-backend.internal"),
)

πŸ“Œ Certificate Pinning

client.PinCertificate("sha256/AAAA...",
    httpcloak.PinOptions{IncludeSubdomains: true})

πŸͺ Request Hooks

client.OnPreRequest(func(req *http.Request) error {
    req.Header.Set("X-Custom", "value")
    return nil
})

client.OnPostResponse(func(resp *httpcloak.Response) {
    log.Printf("Got %d from %s", resp.StatusCode, resp.FinalURL)
})

⏱️ Request Timing

fmt.Printf("DNS: %dms, TCP: %dms, TLS: %dms, Total: %dms\n",
    resp.Timing.DNSLookup,
    resp.Timing.TCPConnect,
    resp.Timing.TLSHandshake,
    resp.Timing.Total)

πŸ”„ Protocol Selection

session = httpcloak.Session(preset="chrome-143", http_version="h3")  # Force HTTP/3
session = httpcloak.Session(preset="chrome-143", http_version="h2")  # Force HTTP/2
session = httpcloak.Session(preset="chrome-143", http_version="h1")  # Force HTTP/1.1

Auto mode tries HTTP/3 first, falls back gracefully.

πŸ“€ Streaming & Uploads

# Stream large downloads
stream = session.get_stream("https://example.com/large-file.zip")
print(f"Size: {stream.content_length} bytes")

with open("file.zip", "wb") as f:
    while True:
        chunk = stream.read(8192)
        if not chunk:
            break
        f.write(chunk)
stream.close()

# Iterator pattern
for chunk in session.get_stream(url).iter_content(chunk_size=8192):
    process(chunk)

# Multipart upload
r = session.post(url, files={
    "file": ("filename.jpg", file_bytes, "image/jpeg")
})

πŸ”’ Authentication

# Basic auth
r = httpcloak.get("https://api.example.com/data",
    auth=("username", "password"),
    preset="chrome-143"
)

# Session-level auth
session = httpcloak.Session(
    preset="chrome-143",
    auth=("username", "password")
)

⏰ Timeouts & Retries

# Timeout
session = httpcloak.Session(preset="chrome-143", timeout=30)

# Per-request timeout
r = session.get("https://slow-api.com/data", timeout=60)
// Go: Timeout and retry configuration
client := client.NewClient("chrome-143",
    client.WithTimeout(30 * time.Second),
    client.WithRetry(3),  // Retry 3 times on 429, 500, 502, 503, 504
    client.WithRetryConfig(
        5,                      // Max retries
        500 * time.Millisecond, // Min backoff
        10 * time.Second,       // Max backoff
        []int{429, 503},        // Status codes to retry
    ),
)

🚫 Redirect Control

// Disable automatic redirects
client := client.NewClient("chrome-143",
    client.WithoutRedirects(),
)

resp, _ := client.Get(ctx, "https://example.com/redirect", nil)
fmt.Println(resp.StatusCode)              // 302
fmt.Println(resp.GetHeader("location"))   // Redirect URL

API Reference

Python

import httpcloak

# Module-level functions
httpcloak.get(url, **kwargs)
httpcloak.post(url, **kwargs)
httpcloak.put(url, **kwargs)
httpcloak.patch(url, **kwargs)
httpcloak.delete(url, **kwargs)
httpcloak.head(url, **kwargs)
httpcloak.options(url, **kwargs)

# Session class
session = httpcloak.Session(
    preset="chrome-143",       # Browser preset
    proxy="socks5://...",      # Proxy URL
    timeout=30,                # Timeout in seconds
    http_version="h3",         # Force protocol: h1, h2, h3, auto
    ech_from="cloudflare.com", # ECH config source
    auth=("user", "pass"),     # Basic auth
)

# Session methods
session.get(url, **kwargs)
session.post(url, data=None, json=None, **kwargs)
session.get_stream(url)        # Streaming download
session.close()

# Response object
response.status_code           # HTTP status
response.ok                    # True if status < 400
response.text                  # Body as string
response.content               # Body as bytes
response.json()                # Parse JSON
response.headers               # Response headers
response.protocol              # h1, h2, or h3
response.url                   # Final URL
response.raise_for_status()    # Raise on 4xx/5xx

Go

import "github.com/sardanioss/httpcloak/client"

// Client creation
c := client.NewClient("chrome-143",
    client.WithTimeout(30 * time.Second),
    client.WithProxy("socks5://..."),
    client.WithRetry(3),
    client.WithoutRedirects(),
    client.WithInsecureSkipVerify(),
)
defer c.Close()

// Request methods
resp, err := c.Get(ctx, url, headers)
resp, err := c.Post(ctx, url, body, headers)
resp, err := c.Put(ctx, url, body, headers)
resp, err := c.Delete(ctx, url, headers)

// Advanced request
resp, err := c.Do(ctx, &client.Request{
    Method:        "GET",
    URL:           url,
    Headers:       map[string][]string{},
    Body:          io.Reader,
    Params:        map[string]string{},
    ForceProtocol: client.ProtocolHTTP3,
    FetchMode:     client.FetchModeCORS,
    Referer:       "https://example.com",
})

// Response object
resp.StatusCode
resp.Protocol
resp.Headers
resp.Body           // io.ReadCloser
resp.Text()         // (string, error)
resp.Bytes()        // ([]byte, error)
resp.JSON(&v)       // error
resp.GetHeader(key) // string
resp.IsSuccess()    // bool
resp.IsRedirect()   // bool

Node.js

import httpcloak from "httpcloak";

// Session creation
const session = new httpcloak.Session({
    preset: "chrome-143",
    proxy: "socks5://...",
    timeout: 30000,
    httpVersion: "h3",
});

// Async methods
await session.get(url, options)
await session.post(url, { json, data, headers })
await session.put(url, options)
await session.delete(url, options)

// Sync methods
session.getSync(url, options)
session.postSync(url, options)
session.close()

// Response object
response.statusCode
response.ok
response.text
response.json()
response.headers
response.protocol

C#

using HttpCloak;

// Session creation
var session = new Session(
    preset: Presets.Chrome143,
    proxy: "socks5://...",
    timeout: 30
);

// Request methods
session.Get(url, headers)
session.Post(url, json: obj, data: dict, headers: dict)
session.Put(url, ...)
session.Delete(url)
session.Dispose()

// Response object
response.StatusCode
response.Ok
response.Text
response.Json<T>()
response.Headers
response.Protocol

Browser Presets

Preset Platform PQ H3
chrome-143 Auto βœ… βœ…
chrome-143-windows Windows βœ… βœ…
chrome-143-macos macOS βœ… βœ…
chrome-143-linux Linux βœ… βœ…
firefox-133 Auto ❌ ❌
chrome-mobile-android Android βœ… βœ…
chrome-mobile-ios iOS βœ… βœ…

PQ = Post-Quantum (X25519MLKEM768) Β· H3 = HTTP/3


Testing Tools

Tool Tests
tls.peet.ws JA3, JA4, HTTP/2 Akamai
quic.browserleaks.com HTTP/3 QUIC fingerprint
cf.erisa.uk Cloudflare bot score
cloudflare.com/cdn-cgi/trace ECH status, TLS version

Dependencies

Custom forks for browser-accurate fingerprinting:


Connect


MIT License

Documentation ΒΆ

Overview ΒΆ

Package httpcloak provides an HTTP client with perfect browser TLS/HTTP fingerprinting.

httpcloak allows you to make HTTP requests that are indistinguishable from real browsers, bypassing TLS fingerprinting, HTTP/2 fingerprinting, and header-based bot detection.

Basic usage:

client := httpcloak.New("chrome-131")
defer client.Close()

resp, err := client.Get(ctx, "https://example.com")
if err != nil {
    log.Fatal(err)
}
fmt.Println(string(resp.Body))

With options:

client := httpcloak.New("chrome-131",
    httpcloak.WithTimeout(30*time.Second),
    httpcloak.WithProxy("http://user:pass@proxy:8080"),
)

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func Presets ΒΆ

func Presets() []string

Presets returns available fingerprint presets

Types ΒΆ

type Client ΒΆ

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

Client is an HTTP client with browser fingerprint spoofing

func New ΒΆ

func New(preset string, opts ...Option) *Client

New creates a new HTTP client with the specified browser fingerprint.

Available presets:

  • "chrome-131" (recommended)
  • "chrome-131-windows"
  • "chrome-131-macos"
  • "chrome-133"
  • "chrome-133-windows"

Example:

client := httpcloak.New("chrome-131")
defer client.Close()

func (*Client) Close ΒΆ

func (c *Client) Close()

Close releases all resources held by the client

func (*Client) Do ΒΆ

func (c *Client) Do(ctx context.Context, req *Request) (*Response, error)

Do executes an HTTP request

func (*Client) Get ΒΆ

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

Get performs a GET request

func (*Client) GetWithHeaders ΒΆ

func (c *Client) GetWithHeaders(ctx context.Context, url string, headers map[string][]string) (*Response, error)

GetWithHeaders performs a GET request with custom headers

func (*Client) Post ΒΆ

func (c *Client) Post(ctx context.Context, url string, body io.Reader, contentType string) (*Response, error)

Post performs a POST request

func (*Client) PostForm ΒΆ

func (c *Client) PostForm(ctx context.Context, url string, body []byte) (*Response, error)

PostForm performs a POST request with form data

func (*Client) PostJSON ΒΆ

func (c *Client) PostJSON(ctx context.Context, url string, body []byte) (*Response, error)

PostJSON performs a POST request with JSON body

type Option ΒΆ

type Option func(*clientConfig)

Option configures the Client

func WithProxy ΒΆ

func WithProxy(proxyURL string) Option

WithProxy sets an HTTP/HTTPS/SOCKS5 proxy

func WithTimeout ΒΆ

func WithTimeout(d time.Duration) Option

WithTimeout sets the request timeout

type RedirectInfo ΒΆ added in v1.5.1

type RedirectInfo struct {
	StatusCode int
	URL        string
	Headers    map[string][]string // Multi-value headers
}

RedirectInfo contains information about a redirect response

type Request ΒΆ

type Request struct {
	Method  string
	URL     string
	Headers map[string][]string // Multi-value headers (matches http.Header)
	Body    io.Reader           // Streaming body for uploads
	Timeout time.Duration
}

Request represents an HTTP request

type Response ΒΆ

type Response struct {
	StatusCode int
	Headers    map[string][]string // Multi-value headers (matches http.Header)
	Body       io.ReadCloser       // Streaming body - call Close() when done
	FinalURL   string
	Protocol   string
	History    []*RedirectInfo
	// contains filtered or unexported fields
}

Response represents an HTTP response

func (*Response) Bytes ΒΆ added in v1.5.3

func (r *Response) Bytes() ([]byte, error)

Bytes reads and returns the entire response body. The body can only be read once unless cached.

func (*Response) Close ΒΆ added in v1.5.3

func (r *Response) Close() error

Close closes the response body.

func (*Response) GetHeader ΒΆ added in v1.5.3

func (r *Response) GetHeader(key string) string

GetHeader returns the first value for the given header key.

func (*Response) GetHeaders ΒΆ added in v1.5.3

func (r *Response) GetHeaders(key string) []string

GetHeaders returns all values for the given header key.

func (*Response) JSON ΒΆ added in v1.5.3

func (r *Response) JSON(v interface{}) error

JSON decodes the response body into the given interface.

func (*Response) Text ΒΆ added in v1.5.3

func (r *Response) Text() (string, error)

Text reads and returns the response body as a string.

type Session ΒΆ

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

Session represents a persistent HTTP session with cookie management

func LoadSession ΒΆ added in v1.5.5

func LoadSession(path string) (*Session, error)

LoadSession loads a session from a file

func NewSession ΒΆ

func NewSession(preset string, opts ...SessionOption) *Session

NewSession creates a new persistent session with cookie management

func UnmarshalSession ΒΆ added in v1.5.5

func UnmarshalSession(data []byte) (*Session, error)

UnmarshalSession loads a session from JSON bytes

func (*Session) Close ΒΆ

func (s *Session) Close()

Close closes the session and releases resources

func (*Session) Do ΒΆ

func (s *Session) Do(ctx context.Context, req *Request) (*Response, error)

Do executes a request within the session, maintaining cookies

func (*Session) DoStream ΒΆ added in v1.5.3

func (s *Session) DoStream(ctx context.Context, req *Request) (*StreamResponse, error)

DoStream executes an HTTP request and returns a streaming response The caller is responsible for closing the response when done Note: Streaming does NOT support redirects - use Do() for redirect handling

func (*Session) DoWithBody ΒΆ added in v1.5.3

func (s *Session) DoWithBody(ctx context.Context, req *Request, bodyReader io.Reader) (*Response, error)

DoWithBody executes a request with an io.Reader as the body for streaming uploads

func (*Session) Get ΒΆ

func (s *Session) Get(ctx context.Context, url string) (*Response, error)

Get performs a GET request within the session

func (*Session) GetCookies ΒΆ

func (s *Session) GetCookies() map[string]string

GetCookies returns all cookies stored in the session

func (*Session) GetStream ΒΆ added in v1.5.3

func (s *Session) GetStream(ctx context.Context, url string) (*StreamResponse, error)

GetStream performs a streaming GET request

func (*Session) GetStreamWithHeaders ΒΆ added in v1.5.3

func (s *Session) GetStreamWithHeaders(ctx context.Context, url string, headers map[string][]string) (*StreamResponse, error)

GetStreamWithHeaders performs a streaming GET request with custom headers

func (*Session) Marshal ΒΆ added in v1.5.5

func (s *Session) Marshal() ([]byte, error)

Marshal exports session state to JSON bytes

func (*Session) Save ΒΆ added in v1.5.5

func (s *Session) Save(path string) error

Save exports session state (cookies, TLS sessions) to a file

func (*Session) SetCookie ΒΆ

func (s *Session) SetCookie(name, value string)

SetCookie sets a cookie in the session

type SessionOption ΒΆ

type SessionOption func(*sessionConfig)

SessionOption configures a session

func WithConnectTo ΒΆ added in v1.5.2

func WithConnectTo(requestHost, connectHost string) SessionOption

WithConnectTo sets a host mapping for domain fronting. Requests to requestHost will connect to connectHost instead. The TLS SNI and Host header will still use requestHost.

func WithECHFrom ΒΆ added in v1.5.2

func WithECHFrom(domain string) SessionOption

WithECHFrom sets a domain to fetch ECH config from. Instead of fetching ECH from the target domain's DNS, the config will be fetched from this domain. Useful for Cloudflare domains - use "cloudflare-ech.com" to get ECH config that works for any Cloudflare-proxied domain.

func WithForceHTTP1 ΒΆ added in v1.0.1

func WithForceHTTP1() SessionOption

WithForceHTTP1 forces HTTP/1.1 protocol

func WithForceHTTP2 ΒΆ added in v1.0.1

func WithForceHTTP2() SessionOption

WithForceHTTP2 forces HTTP/2 protocol

func WithForceHTTP3 ΒΆ added in v1.1.1

func WithForceHTTP3() SessionOption

WithForceHTTP3 forces HTTP/3 protocol (QUIC)

func WithInsecureSkipVerify ΒΆ added in v1.0.1

func WithInsecureSkipVerify() SessionOption

WithInsecureSkipVerify disables SSL certificate verification

func WithRedirects ΒΆ added in v1.0.1

func WithRedirects(follow bool, maxRedirects int) SessionOption

WithRedirects configures redirect behavior

func WithRetry ΒΆ added in v1.0.1

func WithRetry(count int) SessionOption

WithRetry enables retry with default settings

func WithRetryConfig ΒΆ added in v1.0.1

func WithRetryConfig(count int, waitMin, waitMax time.Duration, retryOnStatus []int) SessionOption

WithRetryConfig configures retry behavior

func WithSessionPreferIPv4 ΒΆ added in v1.1.2

func WithSessionPreferIPv4() SessionOption

WithSessionPreferIPv4 makes the session prefer IPv4 addresses over IPv6. Use this on networks with poor IPv6 connectivity.

func WithSessionProxy ΒΆ

func WithSessionProxy(proxyURL string) SessionOption

WithSessionProxy sets a proxy for the session

func WithSessionTCPProxy ΒΆ added in v1.5.3

func WithSessionTCPProxy(proxyURL string) SessionOption

WithSessionTCPProxy sets a proxy for TCP-based protocols (HTTP/1.1 and HTTP/2). Use this with WithSessionUDPProxy for split proxy configuration.

func WithSessionTimeout ΒΆ

func WithSessionTimeout(d time.Duration) SessionOption

WithSessionTimeout sets the timeout for session requests

func WithSessionUDPProxy ΒΆ added in v1.5.3

func WithSessionUDPProxy(proxyURL string) SessionOption

WithSessionUDPProxy sets a proxy for UDP-based protocols (HTTP/3 via MASQUE). Use this with WithSessionTCPProxy for split proxy configuration.

func WithoutRedirects ΒΆ added in v1.0.1

func WithoutRedirects() SessionOption

WithoutRedirects disables automatic redirect following

func WithoutRetry ΒΆ added in v1.0.5

func WithoutRetry() SessionOption

WithoutRetry explicitly disables retry

type StreamResponse ΒΆ added in v1.5.3

type StreamResponse struct {
	StatusCode    int
	Headers       map[string][]string
	FinalURL      string
	Protocol      string
	ContentLength int64 // -1 if unknown (chunked encoding)
	// contains filtered or unexported fields
}

StreamResponse represents a streaming HTTP response where the body is read incrementally. Use this for large file downloads.

func (*StreamResponse) Close ΒΆ added in v1.5.3

func (r *StreamResponse) Close() error

Close closes the response body - must be called when done

func (*StreamResponse) Read ΒΆ added in v1.5.3

func (r *StreamResponse) Read(p []byte) (n int, err error)

Read reads data from the response body

func (*StreamResponse) ReadAll ΒΆ added in v1.5.3

func (r *StreamResponse) ReadAll() ([]byte, error)

ReadAll reads the entire response body into memory This defeats the purpose of streaming but is useful for small responses

func (*StreamResponse) ReadChunk ΒΆ added in v1.5.3

func (r *StreamResponse) ReadChunk(size int) ([]byte, error)

ReadChunk reads up to size bytes from the response

Directories ΒΆ

Path Synopsis
Package client provides an HTTP client with browser TLS/HTTP fingerprint spoofing.
Package client provides an HTTP client with browser TLS/HTTP fingerprint spoofing.
examples
go-examples/basic command
Example: Basic HTTP requests with httpcloak
Example: Basic HTTP requests with httpcloak
go-examples/cloudflare command
Example: Multiple requests to Cloudflare trace endpoint
Example: Multiple requests to Cloudflare trace endpoint
go-examples/high-performance command
Example: High-Performance Downloads
Example: High-Performance Downloads
go-examples/session command
Example: Session management with cookies
Example: Session management with cookies
go-examples/session-resumption command
Example: Session Resumption (0-RTT)
Example: Session Resumption (0-RTT)
go-examples/streaming command
Example: Streaming Downloads with httpcloak
Example: Streaming Downloads with httpcloak
Package protocol defines the IPC message types for communication between the httpcloak daemon and language SDKs (Python, Node.js, etc.)
Package protocol defines the IPC message types for communication between the httpcloak daemon and language SDKs (Python, Node.js, etc.)

Jump to

Keyboard shortcuts

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