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 ¶
- func Presets() []string
- type Client
- func (c *Client) Close()
- func (c *Client) Do(ctx context.Context, req *Request) (*Response, error)
- func (c *Client) Get(ctx context.Context, url string) (*Response, error)
- func (c *Client) GetWithHeaders(ctx context.Context, url string, headers map[string]string) (*Response, error)
- func (c *Client) Post(ctx context.Context, url string, body []byte, contentType string) (*Response, error)
- func (c *Client) PostForm(ctx context.Context, url string, body []byte) (*Response, error)
- func (c *Client) PostJSON(ctx context.Context, url string, body []byte) (*Response, error)
- type Option
- type Request
- type Response
- type Session
- type SessionOption
- func WithForceHTTP1() SessionOption
- func WithForceHTTP2() SessionOption
- func WithInsecureSkipVerify() SessionOption
- func WithRedirects(follow bool, maxRedirects int) SessionOption
- func WithRetry(count int) SessionOption
- func WithRetryConfig(count int, waitMin, waitMax time.Duration, retryOnStatus []int) SessionOption
- func WithSessionProxy(proxyURL string) SessionOption
- func WithSessionTimeout(d time.Duration) SessionOption
- func WithoutRedirects() SessionOption
- func WithoutRetry() SessionOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client with browser fingerprint spoofing
func New ¶
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) 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 []byte, contentType string) (*Response, error)
Post performs a POST request
type Request ¶
type Request struct {
Method string
URL string
Headers map[string]string
Body []byte
Timeout time.Duration
}
Request represents an HTTP request
type Response ¶
type Response struct {
StatusCode int
Headers map[string]string
Body []byte
FinalURL string
Protocol string
}
Response represents an HTTP response
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a persistent HTTP session with cookie management
func NewSession ¶
func NewSession(preset string, opts ...SessionOption) *Session
NewSession creates a new persistent session with cookie management
func (*Session) GetCookies ¶
GetCookies returns all cookies stored in the session
type SessionOption ¶
type SessionOption func(*sessionConfig)
SessionOption configures a session
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 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 WithSessionProxy ¶
func WithSessionProxy(proxyURL string) SessionOption
WithSessionProxy sets a proxy for the session
func WithSessionTimeout ¶
func WithSessionTimeout(d time.Duration) SessionOption
WithSessionTimeout sets the timeout for session requests
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
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/session
command
Example: Session management with cookies
|
Example: Session management with cookies |
|
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.) |