utls

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: GPL-3.0 Imports: 13 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 from a JA3 or parrot string

func NewTransportFromJA3Insecure

func NewTransportFromJA3Insecure(ja3 string) (*Transport, error)

NewTransportFromJA3Insecure creates a http.Transport which mocks the given JA3 signature when HTTPS is used The transport allows an insecure TLS connection by setting InsecureSkipVerify to true

func NewTransportFromJA3WithConfig

func NewTransportFromJA3WithConfig(ja3 string, config *tls.Config) (*Transport, error)

NewTransportFromJA3WithConfig creates a http.Transport object given an utls.Config

func NewTransportFromParrotInsecure

func NewTransportFromParrotInsecure(parrot string) (*Transport, error)

NewTransportFromParrotInsecure takes in a string that represents a ClientHelloID to parrot a TLS connection that looks like associated browser and returns a http transport The InsecureSkipVerify configuration is set to true so that the client WILL accept untrusted SSL/TLS certificates This function exists so that other tools do not need to import the uTLS library to build a config to pass in

func NewTransportFromParrotWithConfig

func NewTransportFromParrotWithConfig(parrot string, config *tls.Config) (*Transport, error)

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

func (*Transport) Proxy

func (t *Transport) Proxy(proxy func(*http.Request) (*url.URL, error))

Proxy adds a Proxy function to the http/1.1 client. HTTP/2 does not support a proxy

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