netprotocol

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Chrome126_mac = BrowserProfile{
		UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",

		Brands:          `"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"`,
		FullVersionList: `"Not)A;Brand";v="99.0.0.0", "Google Chrome";v="126.0.6478.178", "Chromium";v="126.0.6478.178"`,

		Platform:        `macOS`,
		PlatformVersion: "126.0.6478.178",
		Architecture:    "arm",
		Model:           "",
		Mobile:          false,
		Bitness:         "64",
	}
	Chrome127_mac = BrowserProfile{
		UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36",

		Brands:          `"Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"`,
		FullVersionList: `"Not)A;Brand";v="99.0.0.0", "Google Chrome";v="127.0.6533.72", "Chromium";v="127.0.6533.72"`,

		Platform:        `macOS`,
		PlatformVersion: "127.0.6533.72",
		Architecture:    "arm",
		Model:           "",
		Mobile:          false,
		Bitness:         "64",
	}
	Chrome128_mac = BrowserProfile{
		UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",

		Brands:          `"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"`,
		FullVersionList: `"Chromium";v="128.0.6613.137", "Not;A=Brand";v="24.0.0.0", "Google Chrome";v="128.0.6613.137"`,

		Platform:        `macOS`,
		PlatformVersion: "128.0.6613.137",
		Architecture:    "arm",
		Model:           "",
		Mobile:          false,
		Bitness:         "64",
	}
	Chrome129_mac = BrowserProfile{
		UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",

		Brands:          `"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"`,
		FullVersionList: `"Google Chrome";v="129.0.6668.90", "Not=A?Brand";v="8.0.0.0", "Chromium";v="129.0.6668.90"`,

		Platform:        `macOS`,
		PlatformVersion: "129.0.6668.90",
		Architecture:    "arm",
		Model:           "",
		Mobile:          false,
		Bitness:         "64",
	}
	Chrome130_mac = BrowserProfile{
		UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",

		Brands:          `"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"`,
		FullVersionList: `"Chromium";v="130.0.6723.60", "Google Chrome";v="130.0.6723.60", "Not?A_Brand";v="99.0.0.0"`,

		Platform:        `macOS`,
		PlatformVersion: "130.0.6723.60",
		Architecture:    "arm",
		Model:           "",
		Mobile:          false,
		Bitness:         "64",
	}
	Chrome131_mac = BrowserProfile{
		UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",

		Brands:          `"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"`,
		FullVersionList: `"Google Chrome";v="131.0.6778.86", "Chromium";v="131.0.6778.86", "Not_A Brand";v="24.0.0.0"`,

		Platform:        `macOS`,
		PlatformVersion: "131.0.6778.86",
		Architecture:    "arm",
		Model:           "",
		Mobile:          false,
		Bitness:         "64",
	}
	Chrome132_mac = BrowserProfile{
		UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",

		Brands:          `"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"`,
		FullVersionList: `"Not A(Brand";v="8.0.0.0", "Chromium";v="132.0.6834.160", "Google Chrome";v="132.0.6834.160"`,

		Platform:        `macOS`,
		PlatformVersion: "132.0.6834.160",
		Architecture:    "arm",
		Model:           "",
		Mobile:          false,
		Bitness:         "64",
	}
	ChromeLatest_mac = Chrome132_mac

	Chrome127_windows = BrowserProfile{
		UserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36",

		Brands:          `"Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"`,
		FullVersionList: `"Not)A;Brand";v="99.0.0.0", "Google Chrome";v="127.0.6533.89", "Chromium";v="127.0.6533.89"`,

		Platform:        `Windows`,
		PlatformVersion: "127.0.6533.89",
		Architecture:    "x86",
		Model:           "",
		Mobile:          false,
		Bitness:         "64",
	}

	Chrome127_android = BrowserProfile{
		UserAgent: "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Mobile Safari/537.36",

		Brands:          `"Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"`,
		FullVersionList: `"Not)A;Brand";v="99.0.0.0", "Google Chrome";v="127.0.6533.84", "Chromium";v="127.0.6533.84"`,

		Platform:        `Android`,
		PlatformVersion: "127.0.6533.84",
		Architecture:    "",
		Model:           "sdk_gphone64_arm64",
		Mobile:          true,
		Bitness:         "",
	}
)

Functions

This section is empty.

Types

type BaseHttpClient

type BaseHttpClient interface {
	GetContext() context.Context

	GetBrowserProfile() BrowserProfile

	GetProxy() *proxyprotocol.Proxy
	SetProxy(proxy *proxyprotocol.Proxy) error

	GetCookieJar() http.CookieJar
	SetCookieJar(jar http.CookieJar)

	GetHeaderDefaults() map[string]string

	DoRequest(req *Request) (*Response, error)

	Get(url string, headers OrderedHeaders) (*Response, error)
	Post(url string, body any, headers OrderedHeaders) (*Response, error)
	Put(url string, body any, headers OrderedHeaders) (*Response, error)
}

type BrowserProfile

type BrowserProfile struct {
	UserAgent string

	Brands          string
	FullVersionList string

	Platform        string
	PlatformVersion string
	Architecture    string
	Model           string
	Mobile          bool
	Bitness         string
}

func (BrowserProfile) GetHeaderDefaults

func (b BrowserProfile) GetHeaderDefaults() map[string]string

type OrderedHeaders

type OrderedHeaders [][]string

type Request

type Request struct {
	Method  string
	Url     string
	Headers OrderedHeaders

	Body any

	RequestPriority *RequestPriority

	PreloadAndSendAt time.Time
	PreloadSleepFunc func(time.Duration)

	ForceIp net.IP

	DontReadResponseBody bool
}

type RequestPriority

type RequestPriority int
const (
	THROTTLED RequestPriority = 0 // Used to signal that resources
	// should be reserved for following
	// requests (i.e. that higher priority
	// following requests are expected).
	MINIMUM_PRIORITY RequestPriority = THROTTLED
	IDLE             RequestPriority = 1 // Default "as resources available" level.
	LOWEST           RequestPriority = 2
	DEFAULT_PRIORITY RequestPriority = LOWEST
	LOW              RequestPriority = 3
	MEDIUM           RequestPriority = 4
	HIGHEST          RequestPriority = 5
	MAXIMUM_PRIORITY RequestPriority = HIGHEST
)

func PriorityPtr

func PriorityPtr(p RequestPriority) *RequestPriority

type Response

type Response struct {
	*http.Response
	// contains filtered or unexported fields
}

func (*Response) GetBody added in v0.2.8

func (r *Response) GetBody() []byte

func (*Response) JSON

func (r *Response) JSON(v any) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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