utlsx

package
v0.0.0-...-2a80db3 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package utlsx contains UTLS extensions.

Index

Constants

This section is empty.

Variables

View Source
var DefaultClientHelloID = &utls.HelloFirefox_55

DefaultClientHelloID is the default utls.ClientHelloID.

View Source
var DefaultNetDialer = &net.Dialer{
	Timeout:   30 * time.Second,
	KeepAlive: 30 * time.Second,
}

DefaultNetDialer is the default net.Dialer.

Functions

func NewOOHTTPTransport

func NewOOHTTPTransport(
	proxy ProxyFunc, tlsFactory TLSFactoryFunc, tlsDialer TLSDialFunc) *oohttp.StdlibTransport

NewOOHTTPTransport creates a new OOHTTP transport using the given funcs. Each function MAY be nil. In such a case, we'll use a reasonable default.

Types

type ConnFactory

type ConnFactory interface {
	// NewUTLSConn creates a new UTLS connection. The conn and config arguments MUST
	// NOT be nil. We will honour the following fields of config:
	//
	// - RootCAs
	//
	// - NextProtos
	//
	// - ServerName
	//
	// - InsecureSkipVerify
	//
	// - DynamicRecordSizingDisabled
	//
	// However, some of these fields values MAY be ignored depending on the parrot we use.
	NewUTLSConn(conn net.Conn, config *tls.Config) oohttp.TLSConn
}

ConnFactory is a factory for creating UTLS connections.

type FactoryWithParrot

type FactoryWithParrot struct {
	// Parrot is the OPTIONAL parrot.
	Parrot *utls.ClientHelloID
}

FactoryWithParrot implements ConnFactory.

func (*FactoryWithParrot) NewUTLSConn

func (f *FactoryWithParrot) NewUTLSConn(conn net.Conn, config *tls.Config) oohttp.TLSConn

NewUTLSConn implements ConnFactory.

type ProxyFunc

type ProxyFunc func(*oohttp.Request) (*url.URL, error)

ProxyFunc is the the type of the [http.ProxyFromEnvironment] func.

type TLSDialFunc

type TLSDialFunc func(ctx context.Context, network string, addr string) (net.Conn, error)

TLSDialFunc is the type of the TLSDialer.DialTLSContext func.

type TLSDialer

type TLSDialer struct {
	// Config is the OPTIONAL Config. In case it's not nil, we will
	// pass this config to [Factory] rather than a default one.
	Config *tls.Config

	// Parrot is the OPTIONAL parrot to use.
	Parrot *utls.ClientHelloID
	// contains filtered or unexported fields
}

TLSDialer is a dialer that uses UTLS

func (*TLSDialer) DialTLSContext

func (d *TLSDialer) DialTLSContext(ctx context.Context, network string, addr string) (net.Conn, error)

DialTLSContext dials a TLS connection using UTLS.

type TLSFactoryFunc

type TLSFactoryFunc func(conn net.Conn, config *tls.Config) oohttp.TLSConn

TLSFactoryFunc is the type of the [ConnFactory.NewUTLSConn] func.

Jump to

Keyboard shortcuts

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