transport

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package transport provides an HTTP transport layer with TLS fingerprint spoofing. It implements http.RoundTripper and supports both HTTP/1.1 and HTTP/2 with configurable browser profiles for TLS and HTTP/2 fingerprinting.

Index

Constants

View Source
const HeaderOrderKey = http.HeaderOrderKey

HeaderOrderKey is a magic key for http.Header that specifies the order in which HTTP/1.1 headers should be written. Re-exported from internal/fork/http.

View Source
const PHeaderOrderKey = http.PHeaderOrderKey

PHeaderOrderKey is a magic key for http.Header that specifies the order of HTTP/2 pseudo-headers. Re-exported from internal/fork/http.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Method  string
	Host    string
	Path    string
	Headers map[string]string
	Body    io.Reader // Streaming body - no buffering/copying
}

Request represents an HTTP request for the transport.

type Response

type Response struct {
	Status     int
	StatusCode int           // Alias for Status (http.Response compatibility)
	Proto      string        // Protocol version (e.g., "HTTP/2.0")
	Headers    http.Header   // Response headers
	Body       io.ReadCloser // Response body
	ContentLen int64         // Content length (-1 if unknown)
}

Response wraps an HTTP response.

type Transport

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

Transport implements http.RoundTripper with TLS fingerprinting.

func Chrome143Transport

func Chrome143Transport() *Transport

Chrome143Transport returns a transport configured for Chrome 143.

func Firefox146Transport

func Firefox146Transport() *Transport

Firefox146Transport returns a transport configured for Firefox 146.

func NewTransport

func NewTransport(cfg TransportConfig) *Transport

NewTransport creates a new transport with the given configuration.

func Safari261Transport

func Safari261Transport() *Transport

Safari261Transport returns a transport configured for Safari 26.1.

func (*Transport) Close

func (t *Transport) Close() error

Close closes the transport and all connections.

func (*Transport) Do

func (t *Transport) Do(ctx context.Context, req *Request) (*Response, error)

Do executes a request directly (bypassing http.Request conversion).

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type TransportConfig

type TransportConfig struct {
	Profile            *profile.BrowserProfile
	MaxConnsPerHost    int
	IdleTimeout        time.Duration
	Timeout            time.Duration
	Proxy              *htls.ProxyConfig
	DNSCache           *dns.Cache // Optional DNS cache for faster repeated lookups
	InsecureSkipVerify bool       // Skip TLS certificate verification (testing only)
	ForceHTTP1         bool       // Force HTTP/1.1 instead of HTTP/2 (higher throughput, less fingerprint control)
	EnableHTTP3        bool       // Enable HTTP/3 with auto-fallback to HTTP/2
	HeaderOrder        []string   // HTTP header order (overrides browser profile if set)
	PseudoHeaderOrder  []string   // HTTP/2 pseudo-header order (overrides browser profile if set)
}

TransportConfig holds transport configuration.

func DefaultTransportConfig

func DefaultTransportConfig() TransportConfig

DefaultTransportConfig returns sensible defaults.

Jump to

Keyboard shortcuts

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