cycletls

package module
v0.0.0-...-7d65377 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: GPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultChrome_JA3 = "" /* 140-byte string literal not displayed */

Default JA3 fingerprint for Chrome

Variables

This section is empty.

Functions

func ConfigureHTTP3Client

func ConfigureHTTP3Client(client *stdhttp.Client, tlsConfig *tls.Config)

ConfigureHTTP3Client configures an http.Client to use HTTP/3

func ConvertFhttpHeader

func ConvertFhttpHeader(fh fhttp.Header) http.Header

ConvertFhttpHeader converts fhttp.Header to http.Header

func ConvertHttpHeader

func ConvertHttpHeader(h http.Header) fhttp.Header

ConvertHttpHeader converts http.Header to fhttp.Header

func ConvertUtlsConfig

func ConvertUtlsConfig(utlsConfig *utls.Config) *tls.Config

ConvertUtlsConfig converts utls.Config to tls.Config

func CreateExtensionFromID

func CreateExtensionFromID(extID uint16, tlsVersion uint16, components *JA4RComponents, disableGrease bool, serverName string) utls.TLSExtension

CreateExtensionFromID creates an appropriate extension for the given ID

func CreateUQuicSpecFromFingerprint

func CreateUQuicSpecFromFingerprint(quicFingerprint string) (*uquic.QUICSpec, error)

QUIC fingerprinting utilities

func CreateUQuicSpecFromJA4

func CreateUQuicSpecFromJA4(ja4r string) (*uquic.QUICSpec, error)

CreateUQuicSpecFromJA4 creates a QUIC specification from a JA4 fingerprint This function maps JA4 characteristics to appropriate QUIC transport specs

func DecompressBody

func DecompressBody(Body []byte, encoding []string, content []string) (parsedBody []byte)

DecompressBody unzips compressed data following axios-style automatic decompression

func GenerateJA4

func GenerateJA4(tlsVersion uint16, cipherSuites []uint16, extensions []uint16, headers http.Header, userAgent string) string

GenerateJA4 generates a JA4 fingerprint from the TLS handshake and HTTP headers

func GenerateJA4H2

func GenerateJA4H2(settings []http2.Setting, streamDependency uint32, exclusive bool, priorityOrder []string) string

GenerateJA4H2 generates a JA4 HTTP/2 fingerprint from HTTP/2 settings

func GenerateJA4HTTP

func GenerateJA4HTTP(headers http.Header, userAgent string) string

GenerateJA4HTTP generates a JA4 HTTP fingerprint from HTTP headers only

func IsGREASEValue

func IsGREASEValue(extID uint16) bool

IsGREASEValue checks if an extension ID is a GREASE value

func JA4RStringToSpec

func JA4RStringToSpec(ja4r string, userAgent string, forceHTTP1 bool, disableGrease bool, serverName string) (*utls.ClientHelloSpec, error)

JA4RStringToSpec creates a ClientHelloSpec from a JA4_r (raw) string

func MarshalHeader

func MarshalHeader(h fhttp.Header, order []string) http.Header

MarshalHeader preserves header order while converting to http.Header

func NewTransport

func NewTransport(ja3 string, useragent string) fhttp.RoundTripper

NewTransport creates a new HTTP client transport that modifies HTTPS requests to imitiate a specific JA3 hash and User-Agent. # Example Usage import (

"github.com/Danny-Dasilva/CycleTLS/cycletls"
http "github.com/Danny-Dasilva/fhttp" // note this is a drop-in replacement for net/http

)

ja3 := "771,52393-52392-52244-52243-49195-49199-49196-49200-49171-49172-156-157-47-53-10,65281-0-23-35-13-5-18-16-30032-11-10,29-23-24,0" ua := "Chrome Version 57.0.2987.110 (64-bit) Linux"

cycleClient := &http.Client{
	Transport:     cycletls.NewTransport(ja3, ua),
}

cycleClient.Get("https://tls.peet.ws/")

func NewTransportWithHTTP2Fingerprint

func NewTransportWithHTTP2Fingerprint(http2fp string, useragent string) fhttp.RoundTripper

NewTransportWithHTTP2Fingerprint creates a new HTTP client transport with HTTP/2 fingerprinting

func NewTransportWithJA4

func NewTransportWithJA4(ja4 string, useragent string) fhttp.RoundTripper

NewTransportWithJA4 creates a new HTTP client transport that modifies HTTPS requests using JA4 fingerprinting.

func NewTransportWithProxy

func NewTransportWithProxy(ja3 string, useragent string, proxy proxy.ContextDialer) fhttp.RoundTripper

NewTransportWithProxy creates a new HTTP client transport that modifies HTTPS requests to imitiate a specific JA3 hash and User-Agent, optionally specifying a proxy via proxy.ContextDialer.

func PrettyStruct

func PrettyStruct(data interface{}) (string, error)

PrettyStruct formats json

func QUICStringToSpec

func QUICStringToSpec(quicFingerprint string, userAgent string, forceHTTP1 bool) (*utls.ClientHelloSpec, error)

QUICStringToSpec creates a ClientHelloSpec based on a QUIC fingerprint string

func StringToSpec

func StringToSpec(ja3 string, userAgent string, forceHTTP1 bool) (*utls.ClientHelloSpec, error)

StringToSpec creates a ClientHelloSpec based on a JA3 string

func StringToTLS13CompatibleSpec

func StringToTLS13CompatibleSpec(ja3 string, userAgent string, forceHTTP1 bool) (*utls.ClientHelloSpec, error)

StringToTLS13CompatibleSpec creates a TLS 1.3 compatible ClientHelloSpec by filtering curves

func WSEndpoint

func WSEndpoint(w nhttp.ResponseWriter, r *nhttp.Request)

WSEndpoint exports the main cycletls function as we websocket connection that clients can connect to

Types

type Browser

type Browser struct {
	// TLS fingerprinting options
	JA3              string
	JA4r             string // JA4 raw format with explicit cipher/extension values
	HTTP2Fingerprint string
	QUICFingerprint  string
	USpec            *uquic.QUICSpec // UQuic QUIC specification for HTTP3 fingerprinting
	DisableGrease    bool

	// Browser identification
	UserAgent string

	// Connection options
	ServerName         string
	Cookies            []Cookie
	InsecureSkipVerify bool
	ForceHTTP1         bool
	ForceHTTP3         bool

	// TLS 1.3 specific options
	TLS13AutoRetry bool

	// Ordered HTTP header fields
	HeaderOrder []string

	// TLS configuration
	TLSConfig *utls.Config
	// contains filtered or unexported fields
}

func (Browser) SSEConnect

func (browser Browser) SSEConnect(ctx context.Context, urlStr string) (*SSEResponse, error)

SSEConnect establishes an SSE connection

func (Browser) WebSocketConnect

func (browser Browser) WebSocketConnect(ctx context.Context, urlStr string) (*websocket.Conn, *fhttp.Response, error)

WebSocketConnect establishes a WebSocket connection

type ClientPoolEntry

type ClientPoolEntry struct {
	Client    fhttp.Client
	CreatedAt time.Time
	LastUsed  time.Time
}

ClientPoolEntry represents a cached client with metadata

type ContextKeyHeader

type ContextKeyHeader struct{}

ContextKeyHeader Users of context.WithValue should define their own types for keys

type Cookie struct {
	Name  string `json:"name"`
	Value string `json:"value"`

	Path        string `json:"path"`   // optional
	Domain      string `json:"domain"` // optional
	Expires     time.Time
	JSONExpires Time   `json:"expires"`    // optional
	RawExpires  string `json:"rawExpires"` // for reading cookies only

	// MaxAge=0 means no 'Max-Age' attribute specified.
	// MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
	// MaxAge>0 means Max-Age attribute present and given in seconds
	MaxAge   int            `json:"maxAge"`
	Secure   bool           `json:"secure"`
	HTTPOnly bool           `json:"httpOnly"`
	SameSite nhttp.SameSite `json:"sameSite"`
	Raw      string
	Unparsed []string `json:"unparsed"` // Raw text of unparsed attribute-value pairs
}

A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an HTTP response or the Cookie header of an HTTP request.

See https://tools.ietf.org/html/rfc6265 for details.

type CustomApplicationSettingsExtension

type CustomApplicationSettingsExtension struct {
	*utls.GenericExtension
	OriginalID         uint16
	SupportedProtocols []string
}

CustomApplicationSettingsExtension preserves the original extension ID for ALPS

func NewCustomApplicationSettingsExtension

func NewCustomApplicationSettingsExtension(extID uint16, protocols []string) *CustomApplicationSettingsExtension

NewCustomApplicationSettingsExtension creates a new ALPS extension with preserved ID

func (*CustomApplicationSettingsExtension) GetPreservedID

func (c *CustomApplicationSettingsExtension) GetPreservedID() uint16

GetPreservedID returns the original extension ID

type CustomCompressCertificateExtension

type CustomCompressCertificateExtension struct {
	*utls.GenericExtension
	OriginalID uint16
	Algorithms []utls.CertCompressionAlgo
}

CustomCompressCertificateExtension preserves the original extension ID

func NewCustomCompressCertificateExtension

func NewCustomCompressCertificateExtension(extID uint16, algorithms []utls.CertCompressionAlgo) *CustomCompressCertificateExtension

NewCustomCompressCertificateExtension creates a new compress certificate extension

func (*CustomCompressCertificateExtension) GetPreservedID

func (c *CustomCompressCertificateExtension) GetPreservedID() uint16

GetPreservedID returns the original extension ID

type CustomDelegatedCredentialsExtension

type CustomDelegatedCredentialsExtension struct {
	*utls.GenericExtension
	OriginalID          uint16
	SignatureAlgorithms []utls.SignatureScheme
}

CustomDelegatedCredentialsExtension preserves the original extension ID

func NewCustomDelegatedCredentialsExtension

func NewCustomDelegatedCredentialsExtension(extID uint16, algorithms []utls.SignatureScheme) *CustomDelegatedCredentialsExtension

NewCustomDelegatedCredentialsExtension creates a new delegated credentials extension

func (*CustomDelegatedCredentialsExtension) GetPreservedID

func (c *CustomDelegatedCredentialsExtension) GetPreservedID() uint16

GetPreservedID returns the original extension ID

type CustomECHExtension

type CustomECHExtension struct {
	*utls.GenericExtension
	OriginalID uint16
}

CustomECHExtension preserves the original extension ID for Encrypted Client Hello

func NewCustomECHExtension

func NewCustomECHExtension(extID uint16) *CustomECHExtension

NewCustomECHExtension creates a new ECH extension with preserved ID

func (*CustomECHExtension) GetPreservedID

func (c *CustomECHExtension) GetPreservedID() uint16

GetPreservedID returns the original extension ID

type CustomGREASEExtension

type CustomGREASEExtension struct {
	*utls.GenericExtension
	OriginalID uint16
}

CustomGREASEExtension preserves GREASE extension IDs

func NewCustomGREASEExtension

func NewCustomGREASEExtension(extID uint16) *CustomGREASEExtension

NewCustomGREASEExtension creates a new GREASE extension with preserved ID

func (*CustomGREASEExtension) GetPreservedID

func (c *CustomGREASEExtension) GetPreservedID() uint16

GetPreservedID returns the original extension ID

type CustomPostQuantumExtension

type CustomPostQuantumExtension struct {
	*utls.GenericExtension
	OriginalID       uint16
	KeyExchangeGroup uint16
}

CustomPostQuantumExtension for post-quantum key exchange extensions

func NewCustomPostQuantumExtension

func NewCustomPostQuantumExtension(extID uint16, group uint16) *CustomPostQuantumExtension

NewCustomPostQuantumExtension creates a new post-quantum extension

func (*CustomPostQuantumExtension) GetPreservedID

func (c *CustomPostQuantumExtension) GetPreservedID() uint16

GetPreservedID returns the original extension ID

type CustomRecordSizeLimitExtension

type CustomRecordSizeLimitExtension struct {
	*utls.GenericExtension
	OriginalID uint16
	Limit      uint16
}

CustomRecordSizeLimitExtension preserves the original extension ID

func NewCustomRecordSizeLimitExtension

func NewCustomRecordSizeLimitExtension(extID uint16, limit uint16) *CustomRecordSizeLimitExtension

NewCustomRecordSizeLimitExtension creates a new record size limit extension

func (*CustomRecordSizeLimitExtension) GetPreservedID

func (c *CustomRecordSizeLimitExtension) GetPreservedID() uint16

GetPreservedID returns the original extension ID

type CycleTLS

type CycleTLS struct {
	ReqChan    chan fullRequest
	RespChan   chan Response // V1 default: chan Response for backward compatibility
	RespChanV2 chan []byte   `json:"-"` // V2 performance: chan []byte for opt-in users
}

CycleTLS creates full request and response

func Init

func Init(opts ...Option) CycleTLS

Init creates a CycleTLS client with v1 default behavior (chan Response) Use WithRawBytes() option for performance enhancement with chan []byte

func (CycleTLS) Close

func (client CycleTLS) Close()

Close closes the channels

func (CycleTLS) Do

func (client CycleTLS) Do(URL string, options Options, Method string) (Response, error)

Do creates a single HTTP request for integration tests

func (CycleTLS) Queue

func (client CycleTLS) Queue(URL string, options Options, Method string)

Queue queues a request (simplified for integration tests)

type HTTP2Fingerprint

type HTTP2Fingerprint struct {
	Settings         []http2.Setting
	StreamDependency uint32
	Exclusive        bool
	PriorityOrder    []string
}

HTTP2Fingerprint represents an HTTP/2 client fingerprint

func NewHTTP2Fingerprint

func NewHTTP2Fingerprint(fingerprint string) (*HTTP2Fingerprint, error)

NewHTTP2Fingerprint creates a new HTTP2Fingerprint from string format Format: settings|streamDependency|exclusive|priorityOrder Example: "1:65536,2:0,4:6291456,6:262144|15663105|0|m,a,s,p"

func (*HTTP2Fingerprint) Apply

func (f *HTTP2Fingerprint) Apply(conn *http2.Transport)

Apply configures the HTTP/2 connection with the specified fingerprint

func (*HTTP2Fingerprint) String

func (f *HTTP2Fingerprint) String() string

String returns the string representation of the HTTP/2 fingerprint

type HTTP3Connection

type HTTP3Connection struct {
	QuicConn interface{} // Can be *quic.Conn or uquic.EarlyConnection
	RawConn  net.PacketConn
	Proxys   []string
	IsUQuic  bool // Flag to indicate if this is a UQuic connection
}

HTTP3Connection represents an HTTP/3 connection with associated metadata

type HTTP3RoundTripper

type HTTP3RoundTripper struct {
	// TLSClientConfig is the TLS configuration
	TLSClientConfig *tls.Config

	// QuicConfig is the QUIC configuration
	QuicConfig *quic.Config

	// Forwarder is the underlying HTTP/3 transport
	Forwarder *http3.Transport

	// Dialer is the custom dialer for HTTP/3 connections
	Dialer func(ctx context.Context, addr string, tlsCfg *tls.Config, cfg *quic.Config) (*quic.Conn, error)
}

HTTP3RoundTripper implements an HTTP/3 round tripper with support for custom TLS fingerprints

func NewHTTP3RoundTripper

func NewHTTP3RoundTripper(tlsConfig *tls.Config, quicConfig *quic.Config) *HTTP3RoundTripper

NewHTTP3RoundTripper creates a new HTTP/3 round tripper with custom fingerprinting

func (*HTTP3RoundTripper) RoundTrip

func (rt *HTTP3RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the http.RoundTripper interface

type HTTP3Transport

type HTTP3Transport struct {
	// QuicConfig is the QUIC configuration
	QuicConfig *quic.Config

	// TLSClientConfig is the TLS configuration
	TLSClientConfig *tls.Config

	// UQuic integration fields
	UQuicConfig *uquic.Config
	QUICSpec    *uquic.QUICSpec
	UseUQuic    bool // Enable uquic-based transport when QUIC fingerprint is provided

	// MaxIdleConns controls the maximum number of idle connections
	MaxIdleConns int

	// IdleConnTimeout is the maximum amount of time a connection may be idle
	IdleConnTimeout time.Duration

	// ResponseHeaderTimeout is the amount of time to wait for a server's response headers
	ResponseHeaderTimeout time.Duration

	// DialTimeout is the maximum amount of time a dial will wait for a connect to complete
	DialTimeout time.Duration

	// ForceAttemptHTTP2 specifies whether HTTP/2 should be attempted
	ForceAttemptHTTP2 bool

	// DisableCompression, if true, prevents the Transport from
	// requesting compression with an "Accept-Encoding: gzip"
	DisableCompression bool
}

HTTP3Transport represents an HTTP/3 transport with customizable settings

func NewHTTP3Transport

func NewHTTP3Transport(tlsConfig *tls.Config) *HTTP3Transport

NewHTTP3Transport creates a new HTTP/3 transport

func NewHTTP3TransportWithUQuic

func NewHTTP3TransportWithUQuic(tlsConfig *tls.Config, quicSpec *uquic.QUICSpec) *HTTP3Transport

NewHTTP3TransportWithUQuic creates a new HTTP/3 transport with UQuic fingerprinting support

func (*HTTP3Transport) RoundTrip

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

RoundTrip implements the http.RoundTripper interface

type JA4Components

type JA4Components struct {
	TLSVersion     string
	SNI            string // "d" for domain, "i" for IP
	CipherCount    int    // Number of cipher suites
	ExtensionCount int    // Number of extensions
	ALPN           string // ALPN value (e.g., "h2", "h1")
	CipherHash     string
	ExtensionsHash string
	HeadersHash    string // Legacy field
	UserAgentHash  string // Legacy field
}

JA4Components represents the parsed components of a JA4 string

func ParseJA4String

func ParseJA4String(ja4 string) (*JA4Components, error)

ParseJA4String parses a JA4 string into its components JA4 format: <TLS version><cipher hash>_<extensions hash>_<headers hash>_<UA hash> Example: t13d_cd89_1952_bb99

type JA4HComponents

type JA4HComponents struct {
	HTTPMethodVersion string
	HeadersHash       string
	CookiesHash       string
}

JA4HComponents represents the parsed components of a JA4H (HTTP Client) string

func ParseJA4HString

func ParseJA4HString(ja4h string) (*JA4HComponents, error)

ParseJA4HString parses a JA4H (HTTP Client) string into its components JA4H format: <method_version>_<headers_hash>_<cookies_hash> Example: po11_73a4f1e_8b3fce7

type JA4RComponents

type JA4RComponents struct {
	TLSVersion        string
	SNI               string   // "d" for domain, "i" for IP
	CipherCount       int      // Number of cipher suites
	ExtensionCount    int      // Number of extensions
	ExtensionCountStr string   // Original extension count format (e.g., "09")
	ALPN              string   // ALPN value (e.g., "h2" for HTTP/2)
	CipherSuites      []uint16 // Raw cipher suite values
	Extensions        []uint16 // Raw extension values
	SignatureSchemes  []uint16 // Raw signature scheme values (optional, from 4th part)
}

JA4RComponents represents the parsed components of a JA4_r (raw) string

func ParseJA4RString

func ParseJA4RString(ja4r string) (*JA4RComponents, error)

ParseJA4RString parses a JA4_r (raw) string into its components JA4_r format: <prefix>_<ciphers>_<extensions>_<signatures> Example: t13d1717h2_002f,0035,009c,009d,1301,1302,1303_0000,0005,000a,000b,000d_0403,0503,0603,0804,0805,0806

type Option

type Option func(*CycleTLS)

Option configures a CycleTLS client

func WithRawBytes

func WithRawBytes() Option

WithRawBytes enables the performance enhancement channel (RespChanV2 chan []byte) Use this option for performance-critical applications that can handle raw byte responses

type Options

type Options struct {
	URL       string            `json:"url"`
	Method    string            `json:"method"`
	Headers   map[string]string `json:"headers"`
	Body      string            `json:"body"`
	BodyBytes []byte            `json:"bodyBytes"` // New field for binary request data

	// TLS fingerprinting options
	Ja3              string `json:"ja3"`
	Ja4r             string `json:"ja4r"` // JA4 raw format with explicit cipher/extension values
	HTTP2Fingerprint string `json:"http2Fingerprint"`
	QUICFingerprint  string `json:"quicFingerprint"`
	DisableGrease    bool   `json:"disableGrease"` // Disable GREASE for exact JA4 matching

	// Browser identification
	UserAgent string `json:"userAgent"`

	// Connection options
	Proxy              string   `json:"proxy"`
	ServerName         string   `json:"serverName"` // Custom TLS SNI override
	Cookies            []Cookie `json:"cookies"`
	Timeout            int      `json:"timeout"`
	DisableRedirect    bool     `json:"disableRedirect"`
	HeaderOrder        []string `json:"headerOrder"`
	OrderAsProvided    bool     `json:"orderAsProvided"` //TODO
	InsecureSkipVerify bool     `json:"insecureSkipVerify"`

	// Protocol options
	ForceHTTP1 bool   `json:"forceHTTP1"`
	ForceHTTP3 bool   `json:"forceHTTP3"`
	Protocol   string `json:"protocol"` // "http1", "http2", "http3", "websocket", "sse"

	// TLS 1.3 specific options
	TLS13AutoRetry bool `json:"tls13AutoRetry"` // Automatically retry with TLS 1.3 compatible curves (default: true)

	// Connection reuse options
	EnableConnectionReuse bool `json:"enableConnectionReuse"` // Enable connection reuse across requests (default: true)
}

Options sets CycleTLS client options

type PreserveIDExtension

type PreserveIDExtension interface {
	utls.TLSExtension
	GetPreservedID() uint16
}

PreserveIDExtension is an interface for extensions that preserve their original extension ID

type Protocol

type Protocol string

Protocol represents the HTTP protocol version

const (
	// ProtocolHTTP1 represents HTTP/1.1
	ProtocolHTTP1 Protocol = "http1"

	// ProtocolHTTP2 represents HTTP/2
	ProtocolHTTP2 Protocol = "http2"

	// ProtocolHTTP3 represents HTTP/3
	ProtocolHTTP3 Protocol = "http3"

	// ProtocolWebSocket represents WebSocket protocol
	ProtocolWebSocket Protocol = "websocket"

	// ProtocolSSE represents Server-Sent Events
	ProtocolSSE Protocol = "sse"
)

type Response

type Response struct {
	RequestID string            `json:"requestId"`
	Status    int               `json:"status"`
	Body      string            `json:"body"`
	BodyBytes []byte            `json:"bodyBytes"` // New field for binary response data
	Headers   map[string]string `json:"headers"`
	Cookies   []*nhttp.Cookie   `json:"cookies"`
	FinalUrl  string            `json:"finalUrl"`
	Protocol  string            `json:"protocol"`
}

Backward compatibility types and functions for integration tests

func (Response) JSONBody

func (r Response) JSONBody() map[string]interface{}

JSONBody parses the response body as JSON

type SSEClient

type SSEClient struct {
	// HTTP client for SSE connections
	HTTPClient *http.Client

	// Headers to be included in the SSE request
	Headers http.Header

	// LastEventID is the ID of the last event received
	LastEventID string

	// ReconnectionTime is the time to wait before reconnecting
	ReconnectionTime time.Duration
}

SSEClient represents a client for Server-Sent Events

func NewSSEClient

func NewSSEClient(client *http.Client, headers http.Header) *SSEClient

NewSSEClient creates a new SSE client

func (*SSEClient) Connect

func (sse *SSEClient) Connect(ctx context.Context, urlStr string) (*SSEResponse, error)

Connect establishes an SSE connection and returns an SSE response

type SSEEvent

type SSEEvent struct {
	// ID is the event ID
	ID string

	// Event is the event type
	Event string

	// Data is the event data
	Data string

	// Retry is the reconnection time in milliseconds
	Retry int64
}

SSEEvent represents a server-sent event

type SSEResponse

type SSEResponse struct {
	// Response is the HTTP response
	Response *http.Response

	// Scanner is used to read the event stream
	Scanner *bufio.Scanner
	// contains filtered or unexported fields
}

SSEResponse represents a response from an SSE connection

func (*SSEResponse) Close

func (r *SSEResponse) Close() error

Close closes the SSE connection

func (*SSEResponse) NextEvent

func (r *SSEResponse) NextEvent() (*SSEEvent, error)

NextEvent reads the next event from the SSE stream

type SocksDialer

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

func (*SocksDialer) Dial

func (d *SocksDialer) Dial(network, addr string) (net.Conn, error)

func (*SocksDialer) DialContext

func (d *SocksDialer) DialContext(_ context.Context, network, addr string) (net.Conn, error)

type Time

type Time struct {
	time.Time
}

Time wraps time.Time overriddin the json marshal/unmarshal to pass timestamp as integer

type UQuicHTTP3Transport

type UQuicHTTP3Transport struct {
	// TLSClientConfig is the TLS configuration
	TLSClientConfig *tls.Config

	// UQuicConfig is the UQuic configuration
	UQuicConfig *uquic.Config

	// QUICSpec is the QUIC specification for fingerprinting
	QUICSpec *uquic.QUICSpec

	// DialTimeout is the maximum amount of time a dial will wait for a connect to complete
	DialTimeout time.Duration
}

UQuicHTTP3Transport implements HTTP/3 transport with UQuic fingerprinting

func NewUQuicHTTP3Transport

func NewUQuicHTTP3Transport(tlsConfig *tls.Config, quicSpec *uquic.QUICSpec) *UQuicHTTP3Transport

NewUQuicHTTP3Transport creates a new UQuic-based HTTP/3 transport

func (*UQuicHTTP3Transport) RoundTrip

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

RoundTrip implements the http.RoundTripper interface for UQuic transport

type UserAgent

type UserAgent struct {
	UserAgent   string
	HeaderOrder []string
}

type WebSocketClient

type WebSocketClient struct {
	// Dialer is the websocket dialer
	Dialer *websocket.Dialer

	// HTTP client for WebSocket handshake
	HTTPClient *http.Client

	// Headers to be included in the WebSocket handshake
	Headers http.Header
}

WebSocketClient represents a client for WebSocket connections

func NewWebSocketClient

func NewWebSocketClient(tlsConfig *utls.Config, headers http.Header) *WebSocketClient

NewWebSocketClient creates a new WebSocket client

func (*WebSocketClient) Connect

func (wsc *WebSocketClient) Connect(urlStr string) (*websocket.Conn, *http.Response, error)

Connect establishes a WebSocket connection

type WebSocketResponse

type WebSocketResponse struct {
	// Conn is the WebSocket connection
	Conn *websocket.Conn

	// Response is the HTTP response from the WebSocket handshake
	Response *http.Response
}

WebSocketResponse represents a response from a WebSocket connection

func (*WebSocketResponse) Close

func (wsr *WebSocketResponse) Close() error

Close closes the WebSocket connection

func (*WebSocketResponse) Receive

func (wsr *WebSocketResponse) Receive() (int, []byte, error)

Receive receives a message from the WebSocket connection

func (*WebSocketResponse) Send

func (wsr *WebSocketResponse) Send(messageType int, data []byte) error

Send sends a message over the WebSocket connection

Jump to

Keyboard shortcuts

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