utls

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomPaddingStyle

func CustomPaddingStyle(unpaddedLen int) (int, bool)

CustomPaddingStyle is a function to use with TLS extension ID 21, padding. In order to ensure this TLS extension is always enabled, the function never returns 0 or false like the BoringPaddingStyle function in the uTLS library does. Returns a random number between 0 and 65,535 Adapted from https://github.com/refraction-networking/utls/blob/8e1e65eb22d21c635523a31ec2bcb8730991aaad/u_tls_extensions.go#L680 https://www.rfc-editor.org/rfc/rfc7685.html

func JA3toClientHello

func JA3toClientHello(ja3 string) (*tls.ClientHelloSpec, error)

JA3toClientHello creates a ClientHelloSpec based on a JA3 string JA3 string format: SSLVersion,Cipher,SSLExtension,EllipticCurve,EllipticCurvePointFormat

func ParrotStringToClientHelloID

func ParrotStringToClientHelloID(parrot string) (clientHello tls.ClientHelloID, err error)

ParrotStringToClientHelloID reads in a string that represents a uTLS ClientHelloID and returns the real ClientHelloID object https://github.com/refraction-networking/utls/blob/8e1e65eb22d21c635523a31ec2bcb8730991aaad/u_common.go#L150

Types

type Transport

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

Transport is custom http.Transport that switches clients between HTTP/1.1 and HTTP2 depending on which protocol was negotiated during the TLS handshake. It is also used to create a http.Transport structure from a JA3 or parrot string

func NewTransportFromJA3

func NewTransportFromJA3(ja3 string, InsecureSkipVerify bool, proxy func(*http.Request) (*url.URL, error)) (*Transport, error)

NewTransportFromJA3 creates a new http.Transport object given an utls.Config

func NewTransportFromParrot

func NewTransportFromParrot(parrot string, InsecureSkipVerify bool, proxy func(*http.Request) (*url.URL, error)) (*Transport, error)

NewTransportFromParrot takes in a string that represents a ClientHelloID to parrot a TLS connection that looks like an associated browser and returns a http transport structure

func (*Transport) RoundTrip

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

RoundTrip completes the TLS handshake and creates a http client depending on the negotiated http version during the TLS handshake (e.g., http/1.1 or h2). After the handshake, the HTTP request is sent to the destination.

Jump to

Keyboard shortcuts

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