Documentation
¶
Overview ¶
Package impersonate provides an http.Client whose TLS handshake is byte-identical to a real browser's, so requests survive JA3/JA4 fingerprinting (Cloudflare, Akamai, etc.) without a headless browser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Chrome = chrome() Firefox = firefox() Safari = safari() Edge = edge() IOS = ios() )
Built-in browser profiles (latest stable at release time).
View Source
var Profiles = map[string]Profile{ "chrome": Chrome, "firefox": Firefox, "safari": Safari, "edge": Edge, "ios": IOS, }
Profiles maps names to profiles for lookup by string.
Functions ¶
func NewTransport ¶
func NewTransport(p Profile) http.RoundTripper
NewTransport returns a RoundTripper with the profile's TLS + headers.
Types ¶
type Profile ¶
type Profile struct {
Name string
ClientHello utls.ClientHelloID
Headers http.Header
HeaderOrder []string
H2Settings []http2.Setting
H2ConnWindow uint32
H2PseudoOrder []string
}
func (Profile) DialTLSContext ¶ added in v0.3.0
DialTLSContext dials addr and performs the profile's browser-exact TLS handshake (JA3/JA4 identical to the browser), returning the established connection. Plug it into a WebSocket client to get browser-fingerprinted wss:// connections:
// coder/websocket:
websocket.Dial(ctx, "wss://host/path", &websocket.DialOptions{
HTTPClient: &http.Client{Transport: impersonate.NewTransport(impersonate.Chrome)},
})
// gorilla/websocket:
d := websocket.Dialer{NetDialTLSContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
return impersonate.Chrome.DialTLSContext(ctx, network, addr)
}}
Click to show internal directories.
Click to hide internal directories.