cleanhttp

package
v0.0.0-...-8ad903c Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateContentLength

func CalculateContentLength(reader io.Reader) (int64, error)

func GenerateAcceptLanguageHeader

func GenerateAcceptLanguageHeader(languages []string) string

func ImageToBase64

func ImageToBase64(filePath string) (string, error)

Convert file image and return it as base64 string to use it in request.

Types

type CleanHttp

type CleanHttp struct {
	Config     *Config
	Client     tls_client.HttpClient
	BaseHeader *HeaderBuilder
	Log        bool
}

func NewCleanHttpClient

func NewCleanHttpClient(config *Config) (*CleanHttp, error)

create http client and return *CleanHttp. Take *Config as params.

func (*CleanHttp) Do

func (c *CleanHttp) Do(request RequestOption) (*http.Response, error)

func (*CleanHttp) GenerateBaseHeaders

func (c *CleanHttp) GenerateBaseHeaders() *HeaderBuilder

func (*CleanHttp) GetDefaultHeader

func (c *CleanHttp) GetDefaultHeader() http.Header

type Config

type Config struct {
	Proxy     string
	Timeout   int
	Log       bool
	BrowserFp *fp.Fingerprint

	ReadTimeout, WriteTimeout, MaxIdleConnDuration time.Duration
}

type FastCleanHttp

type FastCleanHttp struct {
	Config     *Config
	Client     *fasthttp.Client
	BaseHeader *HeaderBuilder
	Log        bool
}

func NewFastCleanHttpClient

func NewFastCleanHttpClient(config *Config) (*FastCleanHttp, error)

create http client and return *CleanHttp. Take *Config as params.

func (*FastCleanHttp) Do

func (c *FastCleanHttp) Do(request RequestOption) (*fasthttp.Response, error)

func (*FastCleanHttp) GenerateBaseHeaders

func (c *FastCleanHttp) GenerateBaseHeaders() *HeaderBuilder

func (*FastCleanHttp) GetDefaultHeader

func (c *FastCleanHttp) GetDefaultHeader() http.Header

type HeaderBuilder

type HeaderBuilder struct {
	SecChUa         string
	SecChUaPlatform string
	SecChUaMobile   string
	AcceptLanguage  string
	UaInfo          UserAgentInfo
}

type RequestOption

type RequestOption struct {
	Ja3                    string
	Method                 string
	Body                   io.Reader
	Url                    string
	Header                 http.Header
	CalculateContentLength bool
}

type UserAgentInfo

type UserAgentInfo struct {
	BrowserName    string
	BrowserVersion string
	OSName         string
	OSVersion      string
	UaVersion      string
}

func ParseUserAgent

func ParseUserAgent(userAgentString string) *UserAgentInfo

Parse user-agent informations and return *UserAgentInfo.

Jump to

Keyboard shortcuts

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