Overview
Theclient package provides an HTTP client with TLS fingerprinting, HTTP/2 fingerprint control, custom cookie handling, and proxy support. It enables you to make HTTP requests that mimic specific browsers and platforms while maintaining fine-grained control over connection settings.
Key Capabilities
- TLS Fingerprinting: Mimic TLS handshakes of Chrome, Edge, Brave, Safari, and Firefox
- HTTP/2 Fingerprinting: Control SETTINGS frames, WINDOW_UPDATE, and pseudo-header ordering
- Browser Profiles: Pre-configured profiles for multiple browsers and platforms
- Cookie Management: Advanced cookie jar with support for non-standard cookie values
- Proxy Support: HTTP, HTTPS, SOCKS5, and SOCKS5H proxies with authentication
- Header Control: Custom header ordering and pseudo-header sequencing
- Automatic Decompression: Support for gzip, deflate, brotli, and zstd
Basic Usage
Creating a Client
Making Requests
Customizing Browser Profile
Using Proxies
Client Type
Type Definition
Client type is the main entry point for making HTTP requests with advanced fingerprinting capabilities.
Core Methods
New
Creates a new Client with the given options.Variadic configuration options to customize the client behavior
- Browser: Chrome
- Version: 131.0.0.0
- Platform: Windows
- Keep-alives: Disabled
- Session tickets: Disabled
- TLS verification: Skipped
- Decompression: Enabled
*Client and error if jar creation fails
Source: /home/daytona/workspace/source/pkg/client/client.go:45
Do
Sends an HTTP request and returns an HTTP response.The HTTP request to send
*http.Response and error
Errors:
ErrTooManyRedirects: When request exceeds 10 redirects- Network errors, TLS errors, or cookie extraction errors
/home/daytona/workspace/source/pkg/client/client.go:115
UserAgent
Returns the default User-Agent header from the transport.- Chrome Windows:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" - Safari macOS:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15"
/home/daytona/workspace/source/pkg/client/client.go:366
ClientHint
Returns the default sec-ch-ua header from the transport."Chromium";v="131", "Google Chrome";v="131", "Not/A)Brand";v="8"
Source: /home/daytona/workspace/source/pkg/client/client.go:375
Proxy
Returns the proxy configuration used by this client.*Proxy or nil if no proxy is configured
Source: /home/daytona/workspace/source/pkg/client/client.go:384
Constants
ErrTooManyRedirects
/home/daytona/workspace/source/pkg/client/client.go:21
Protocol Support
Supported Protocols
- HTTPS Only: Only
https://URLs are supported - HTTP/1.1: Automatic fallback when server doesn’t support HTTP/2
- HTTP/2: Preferred protocol with full fingerprint control
- ALPN Negotiation: Automatic protocol selection based on TLS handshake
Redirect Handling
The client automatically follows redirects with these behaviors:- 301, 302, 303: Changes method to GET
- 307, 308: Preserves original method
- Cookie Persistence: Cookies from redirect responses are stored and applied
- Maximum Redirects: 10 (returns
ErrTooManyRedirectsif exceeded)
/home/daytona/workspace/source/pkg/client/client.go:208
Example: Complete Workflow
Related Documentation
- Configuration Options - Detailed option functions
- TLS Fingerprinting - Browser profiles and fingerprinting
- Cookie Management - Cookie jar operations
