client

package module
v1.0.28 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: BSD-3-Clause Imports: 22 Imported by: 1

Documentation

Overview

Package client provides a complete browser fingerprint simulation client Full-stack simulation from TCP/IP to TLS to HTTP layer

Package client provides real browser fingerprint simulation and request tracing

Package client provides complete browser fingerprint simulationtransport layer with profile-driven TCP/IP and TLS behavior.

Index

Constants

View Source
const (
	// TimeoutDialConnect - TCP/IP connection establishment timeout
	TimeoutDialConnect = core.DefaultDialTimeout

	// TimeoutTLS - TLS handshake timeout
	TimeoutTLS = core.DefaultTLSTimeout

	// TimeoutDNS - DNS resolution timeout
	TimeoutDNS = core.DefaultDNSTimeout

	// TimeoutReadHeader - HTTP response header read timeout
	TimeoutReadHeader = core.DefaultReadTimeout

	// TimeoutRequest - Single request timeout
	TimeoutRequest = core.DefaultTimeout

	// TimeoutTotal - Total request timeout (including redirects)
	TimeoutTotal = 60 * time.Second

	// KeepAliveInterval - TCP keep-alive interval
	KeepAliveInterval = 30 * time.Second
)

Timeout constants definition (using core package standard values)

Variables

View Source
var DefaultOptions = &ClientOptions{
	Timeout:         TimeoutRequest,
	FollowRedirects: true,
}

DefaultOptions provides default client options

Functions

This section is empty.

Types

type BrowserClient

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

BrowserClient is the complete browser fingerprint client

func NewBrowserClient

func NewBrowserClient(profile profiles.ClientProfile, opts ...*ClientOptions) (*BrowserClient, error)

NewBrowserClient creates a new browser fingerprint client

func NewTracedClient

func NewTracedClient(profile profiles.ClientProfile, url, method string, opts ...*ClientOptions) (*BrowserClient, error)

NewTracedClient creates a new client with request tracing

func (*BrowserClient) Close

func (bc *BrowserClient) Close() error

Close closes the client

func (*BrowserClient) Do

func (bc *BrowserClient) Do(req *fhttp.Request) (*fhttp.Response, error)

Do executes an HTTP request

func (*BrowserClient) Get

func (bc *BrowserClient) Get(url string) (*fhttp.Response, error)

Get initiates a GET request

func (*BrowserClient) GetProfile

func (bc *BrowserClient) GetProfile() profiles.ClientProfile

GetProfile returns the fingerprint profile in use

func (*BrowserClient) GetTrace

func (bc *BrowserClient) GetTrace() *RequestTrace

GetTrace returns request tracing information

func (*BrowserClient) Post

func (bc *BrowserClient) Post(url string, contentType string, body io.Reader) (*fhttp.Response, error)

Post initiates a POST request

type ClientOptions

type ClientOptions struct {
	Timeout         time.Duration
	FollowRedirects bool
	ProxyURL        string
	// StrictFingerprint disallows standard TLS compatibility fallback, ensuring requests always use fingerprint chain
	StrictFingerprint bool
}

ClientOptions defines client configuration options

type ConnectionInfo

type ConnectionInfo struct {
	LocalAddr     string        `json:"localAddr"`
	RemoteAddr    string        `json:"remoteAddr"`
	ConnectTime   time.Duration `json:"connectTime"`
	HandshakeTime time.Duration `json:"handshakeTime"`
	TotalTime     time.Duration `json:"totalTime"`
	Protocol      string        `json:"protocol"`     // h2, http/1.1, h3
	ProtocolUsed  string        `json:"protocolUsed"` // Actual protocol used
	ALPN          string        `json:"alpn"`         // Negotiated ALPN
	TLSVersion    string        `json:"tlsVersion"`
	CipherSuite   string        `json:"cipherSuite"`
}

ConnectionInfo contains connection information

type ErrorType

type ErrorType int

ErrorType errortype

const (
	ErrorTypeUnknown ErrorType = iota
	ErrorTypeProtocol
	ErrorTypeNetwork
	ErrorTypeTLS
	ErrorTypeTimeout
	ErrorTypeCanceled
	ErrorTypeDNS
)

type HTTP2SettingsTrace

type HTTP2SettingsTrace struct {
	HeaderTableSize      uint32 `json:"headerTableSize"`
	EnablePush           uint32 `json:"enablePush"`
	MaxConcurrentStreams uint32 `json:"maxConcurrentStreams"`
	InitialWindowSize    uint32 `json:"initialWindowSize"`
	MaxFrameSize         uint32 `json:"maxFrameSize"`
	MaxHeaderListSize    uint32 `json:"maxHeaderListSize"`
	ConnectionFlow       uint32 `json:"connectionFlow"`
	PriorityFrames       int    `json:"priorityFrames"`
}

HTTP2SettingsTrace contains HTTP/2 settings tracing

type HTTP3SettingsTrace

type HTTP3SettingsTrace struct {
	QUICVersion    uint32 `json:"quicVersion"`
	InitialMaxData uint64 `json:"initialMaxData"`
	MaxStreamsBidi uint64 `json:"maxStreamsBidi"`
	MaxStreamsUni  uint64 `json:"maxStreamsUni"`
	MaxUDPPayload  uint64 `json:"maxUdpPayload"`
	Active         bool   `json:"active"`
}

HTTP3SettingsTrace contains HTTP/3 settings tracing

type HTTPFingerprint

type HTTPFingerprint struct {
	Protocol       string              `json:"protocol"`       // HTTP/1.1, HTTP/2, HTTP/3
	Headers        map[string]string   `json:"headers"`        // Actual request headers sent
	HeaderOrder    []string            `json:"headerOrder"`    // Request header order
	PseudoHeaders  []string            `json:"pseudoHeaders"`  // HTTP/2 pseudo header order
	HTTP2Settings  *HTTP2SettingsTrace `json:"http2Settings"`  // HTTP/2 settings frame
	HTTP3Settings  *HTTP3SettingsTrace `json:"http3Settings"`  // HTTP/3 settings
	UserAgent      string              `json:"userAgent"`      // User-Agent
	Accept         string              `json:"accept"`         // Accept
	AcceptLanguage string              `json:"acceptLanguage"` // Accept-Language
	AcceptEncoding string              `json:"acceptEncoding"` // Accept-Encoding
}

HTTPFingerprint contains HTTP layer fingerprint details

type ProfileInfo

type ProfileInfo struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	BrowserType    string `json:"browserType"`
	BrowserVersion string `json:"browserVersion"`
	OS             string `json:"os"`
	OSVersion      string `json:"osVersion"`
}

ProfileInfo contains information about the profile used

type ProxyResult

type ProxyResult struct {
	Success       bool                   `json:"success"`
	Error         string                 `json:"error,omitempty"`
	ErrorType     string                 `json:"errorType,omitempty"`    // Error classification: timeout, network, protocol, etc
	ErrorCode     int                    `json:"errorCode,omitempty"`    // HTTP status code or error code
	ErrorDetails  map[string]interface{} `json:"errorDetails,omitempty"` // Detailed error information
	RequestTrace  *RequestTrace          `json:"requestTrace"`
	ResponseTrace *ResponseTrace         `json:"responseTrace"`
	ProfileUsed   *ProfileInfo           `json:"profileUsed"`
}

ProxyResult contains complete proxy request result

func ExecuteProxyRequest

func ExecuteProxyRequest(profile profiles.ClientProfile, url, method, body string, extraHeaders map[string]string) *ProxyResult

type RequestTrace

type RequestTrace struct {
	Timestamp time.Time `json:"timestamp"`
	RequestID string    `json:"requestId"`
	TargetURL string    `json:"targetUrl"`
	Method    string    `json:"method"`

	// TCP/IP layer fingerprint - actual TCP parameters used
	TCPIP *TCPIPFingerprint `json:"tcpip"`

	// TLS layer fingerprint - actual ClientHello sent
	TLS *TLSFingerprint `json:"tls"`

	// HTTP layer fingerprint - actual request headers sent
	HTTP *HTTPFingerprint `json:"http"`

	// Connection information
	Connection *ConnectionInfo `json:"connection"`
}

RequestTrace contains request tracing information - showing the actual fingerprint sent to server

type RequestTracer

type RequestTracer struct {
	Trace *RequestTrace
}

RequestTracer is the request tracer

func NewRequestTracer

func NewRequestTracer(profile profiles.ClientProfile, url, method string) *RequestTracer

NewRequestTracer creates a new request tracer

type ResponseTrace

type ResponseTrace struct {
	StatusCode   int               `json:"statusCode"`
	Status       string            `json:"status"`
	Protocol     string            `json:"protocol"`
	Headers      map[string]string `json:"headers"`
	BodyPreview  string            `json:"bodyPreview"`
	BodyLength   int               `json:"bodyLength"`
	ResponseTime time.Duration     `json:"responseTime"`
}

ResponseTrace contains response tracing information

type SmartTransport

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

SmartTransport executes profile-aware HTTP requests.

func NewSmartTransport

func NewSmartTransport(profile profiles.ClientProfile) (*SmartTransport, error)

NewSmartTransport create smart transport layer

func (*SmartTransport) Close

func (st *SmartTransport) Close() error

func (*SmartTransport) RoundTrip

func (st *SmartTransport) RoundTrip(req *fhttp.Request) (*fhttp.Response, error)

RoundTrip executes request and returns a unified *fhttp.Response.

func (*SmartTransport) SetStrictFingerprint

func (st *SmartTransport) SetStrictFingerprint(strict bool)

SetStrictFingerprint toggles strict fingerprint mode.

type TCPIPFingerprint

type TCPIPFingerprint struct {
	TTL           uint8  `json:"ttl"`           // Time To Live
	WindowSize    uint16 `json:"windowSize"`    // TCP Window Size
	MSS           uint16 `json:"mss"`           // Maximum Segment Size
	WindowScale   uint8  `json:"windowScale"`   // Window Scale Option
	DF            bool   `json:"df"`            // Don't Fragment flag
	SackPermitted bool   `json:"sackPermitted"` // SACK permitted
	Timestamps    bool   `json:"timestamps"`    // TCP Timestamps
	JA4T          string `json:"ja4t"`          // JA4T fingerprint hash
}

TCPIPFingerprint contains TCP/IP layer fingerprint details

type TLSFingerprint

type TLSFingerprint struct {
	Version         string   `json:"version"`         // TLS version
	JA3             string   `json:"ja3"`             // JA3 fingerprint
	JA3Hash         string   `json:"ja3Hash"`         // JA3 hash
	CipherSuites    []string `json:"cipherSuites"`    // Cipher suites list
	Extensions      []string `json:"extensions"`      // Extensions list
	SupportedGroups []string `json:"supportedGroups"` // Supported curves
	ECPointFormats  []string `json:"ecPointFormats"`  // EC point formats
	ALPNProtocols   []string `json:"alpnProtocols"`   // ALPN protocols
	ClientHelloID   string   `json:"clientHelloId"`   // ClientHello identifier
}

TLSFingerprint contains TLS layer fingerprint details

type TracedClient

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

TracedClient is a client with request tracing capability

Jump to

Keyboard shortcuts

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