tls_client_cffi_src

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: BSD-4-Clause Imports: 14 Imported by: 4

Documentation

Overview

tls_client_cffi_src provides and manages a CFFI (C Foreign Function Interface) which allows code in other languages to interact with the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildResponse

func BuildResponse(sessionId string, withSession bool, resp *http.Response, cookies []*http.Cookie, input RequestInput) (Response, *TLSClientError)

BuildResponse constructs a client response from a given HTTP response. The client response can then be sent to the interface consumer.

func ClearSessionCache

func ClearSessionCache()

ClearSessionCache empties the client session storage.

func GetClient

func GetClient(sessionId string) (tls_client.HttpClient, error)

GetClient returns the client with the given sessionId from the client session storage. If there is no client with the given sessionId, it returns an error.

func RemoveSession

func RemoveSession(sessionId string)

RemoveSession deletes the client with the given sessionId from the client session storage.

Types

type AddCookiesToSessionInput

type AddCookiesToSessionInput struct {
	SessionId string         `json:"sessionId"`
	Url       string         `json:"url"`
	Cookies   []*http.Cookie `json:"cookies"`
}

type CookieInput

type CookieInput struct {
	Name    string    `json:"name"`
	Value   string    `json:"value"`
	Path    string    `json:"path"`
	Domain  string    `json:"domain"`
	Expires Timestamp `json:"expires"`
}

type CookiesFromSessionOutput

type CookiesFromSessionOutput struct {
	Id      string         `json:"id"`
	Cookies []*http.Cookie `json:"cookies"`
}

type CustomTlsClient

type CustomTlsClient struct {
	Ja3String                               string            `json:"ja3String"`
	SupportedSignatureAlgorithms            []string          `json:"supportedSignatureAlgorithms"`
	SupportedDelegatedCredentialsAlgorithms []string          `json:"supportedDelegatedCredentialsAlgorithms"`
	SupportedVersions                       []string          `json:"supportedVersions"`
	KeyShareCurves                          []string          `json:"keyShareCurves"`
	CertCompressionAlgo                     string            `json:"certCompressionAlgo"`
	H2Settings                              map[string]uint32 `json:"h2Settings"`
	H2SettingsOrder                         []string          `json:"h2SettingsOrder"`
	PseudoHeaderOrder                       []string          `json:"pseudoHeaderOrder"`
	ConnectionFlow                          uint32            `json:"connectionFlow"`
	PriorityFrames                          []PriorityFrames  `json:"priorityFrames"`
	HeaderPriority                          *PriorityParam    `json:"headerPriority"`
}

CustomTlsClient contains custom TLS specifications to construct a client from.

type DestroyOutput

type DestroyOutput struct {
	Id      string `json:"id"`
	Success bool   `json:"success"`
}

type DestroySessionInput

type DestroySessionInput struct {
	SessionId string `json:"sessionId"`
}

type GetCookiesFromSessionInput

type GetCookiesFromSessionInput struct {
	SessionId string `json:"sessionId"`
	Url       string `json:"url"`
}

type PriorityFrames

type PriorityFrames struct {
	StreamID      uint32        `json:"streamID"`
	PriorityParam PriorityParam `json:"priorityParam"`
}

type PriorityParam

type PriorityParam struct {
	StreamDep uint32 `json:"streamDep"`
	Exclusive bool   `json:"exclusive"`
	Weight    uint8  `json:"weight"`
}

type RequestInput

type RequestInput struct {
	SessionId                   *string             `json:"sessionId"`
	TLSClientIdentifier         string              `json:"tlsClientIdentifier"`
	CustomTlsClient             *CustomTlsClient    `json:"customTlsClient"`
	CertificatePinningHosts     map[string][]string `json:"certificatePinningHosts"`
	IsRotatingProxy             bool                `json:"isRotatingProxy"`
	FollowRedirects             bool                `json:"followRedirects"`
	ForceHttp1                  bool                `json:"forceHttp1"`
	CatchPanics                 bool                `json:"catchPanics"`
	IsByteResponse              bool                `json:"isByteResponse"`
	WithDebug                   bool                `json:"withDebug"`
	IsByteRequest               bool                `json:"isByteRequest"`
	WithoutCookieJar            bool                `json:"withoutCookieJar"`
	WithDefaultCookieJar        bool                `json:"withDefaultCookieJar"`
	WithRandomTLSExtensionOrder bool                `json:"withRandomTLSExtensionOrder"`
	InsecureSkipVerify          bool                `json:"insecureSkipVerify"`
	TimeoutSeconds              int                 `json:"timeoutSeconds"`
	TimeoutMilliseconds         int                 `json:"timeoutMilliseconds"`
	ProxyUrl                    *string             `json:"proxyUrl"`
	AdditionalDecode            *string             `json:"additionalDecode"`
	Headers                     map[string]string   `json:"headers"`
	HeaderOrder                 []string            `json:"headerOrder"`
	RequestUrl                  string              `json:"requestUrl"`
	RequestMethod               string              `json:"requestMethod"`
	RequestBody                 *string             `json:"requestBody"`
	RequestCookies              []CookieInput       `json:"requestCookies"`
	StreamOutputPath            *string             `json:"streamOutputPath"`
	StreamOutputBlockSize       *int                `json:"streamOutputBlockSize"`
	StreamOutputEOFSymbol       *string             `json:"streamOutputEOFSymbol"`
}

RequestInput is the data a Python client can construct a client and request from.

type Response

type Response struct {
	Id           string              `json:"id"`
	SessionId    string              `json:"sessionId,omitempty"`
	Status       int                 `json:"status"`
	UsedProtocol string              `json:"usedProtocol"`
	Target       string              `json:"target"`
	Body         string              `json:"body"`
	Headers      map[string][]string `json:"headers"`
	Cookies      map[string]string   `json:"cookies"`
}

Response is the response that is sent back to the Python client.

type TLSClientError

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

func BuildRequest

func BuildRequest(input RequestInput) (*http.Request, *TLSClientError)

BuildRequest constructs a HTTP request from a given RequestInput.

func CreateClient

func CreateClient(requestInput RequestInput) (client tls_client.HttpClient, sessionID string, withSession bool, clientErr *TLSClientError)

CreateClient creates a new client from a given RequestInput.

The RequestInput should only contain a TLSClientIdentifier or a CustomTlsClient. If both are provided, an error will be returned.

func NewTLSClientError

func NewTLSClientError(err error) *TLSClientError

func (*TLSClientError) Error

func (e *TLSClientError) Error() string

type Timestamp

type Timestamp struct {
	time.Time
}

func (*Timestamp) UnmarshalJSON

func (p *Timestamp) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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