cleanhttp

package
v0.0.0-...-ae10c36 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

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 GetTLSProfile

func GetTLSProfile() tls_client.ClientProfile

Chrome 114 exact browser TLS.

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
	TLSClient tls_client.HttpClient
	Cookies   []*http.Cookie
}

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)

Do request and return *http.Response, Take RequestOption in params.

func (*CleanHTTP) FormatCookies

func (c *CleanHTTP) FormatCookies() string

Take all cookies from client and return them as a header format string.

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
	BrowserFp *fp.Fingerprint
	TLSFp     *fp.TLSFingerprint
	Profile   tls_client.ClientProfile
}

type HeaderBuilder

type HeaderBuilder struct {
	SecChUa         string
	SecChUaPlatform string

	AcceptLanguage string
	Cookies        string
	// contains filtered or unexported fields
}

type RequestOption

type RequestOption struct {
	Method string
	Body   io.Reader
	URL    string
	Header http.Header
}

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