Documentation
¶
Index ¶
- Constants
- func DeleteFile(filePath string) error
- func Dialer(protocol int, proxyAddr, userID string, timeout time.Duration) func(string, string) (net.Conn, error)
- func FasthttpDialer(protocol int, proxyAddr, userID string, timeout time.Duration) func(string) (net.Conn, error)
- func GetCookies(u string) ([]*http.Cookie, error)
- func Init()
- func PrepareProxy(option *RequestOptions, targetURL string) (*fasthttp.Client, error)
- func Proxy(ctx *fasthttp.RequestCtx)
- func ReadAll(res *fasthttp.Response) ([]byte, error)
- func SaveFile(filePath string, data *[]byte) error
- func SetCookiesString(u string, cookies []string) error
- func TouchFile(filePath string) (*os.File, error)
- type RequestOptions
- type Response
- type StringOrBytes
Constants ¶
View Source
const ( SOCKS4 = iota SOCKS4A )
Variables ¶
This section is empty.
Functions ¶
func DeleteFile ¶
func FasthttpDialer ¶
func PrepareProxy ¶
func PrepareProxy(option *RequestOptions, targetURL string) (*fasthttp.Client, error)
func Proxy ¶
func Proxy(ctx *fasthttp.RequestCtx)
func SetCookiesString ¶
Types ¶
type RequestOptions ¶
type RequestOptions struct {
Headers map[string]string `json:"headers"`
Method string `json:"method"`
ProxyHost string `json:"proxy_host"`
ProxyScheme string `json:"proxy_scheme"`
ProxyUserName string `json:"proxy_username"`
ProxyPassword string `json:"proxy_password"`
RequestBody string `json:"request_body"`
RequestBodyRaw []byte `json:"request_body_raw"`
Timeout int `json:"timeout"`
TlsSpoofConfig cycletls.Options `json:"tls_spoof_config"`
}
type Response ¶
type Response[T StringOrBytes] struct { Res *fasthttp.Response Body T }
func Request ¶
func Request[T StringOrBytes](url string, option *RequestOptions, readPreference func(*fasthttp.Response) ([]byte, error)) (Response[T], error)
Request makes an HTTP request and returns the response as type T.
Parameters:
url: The URL to send the request to. option: Pointer to RequestOptions struct containing headers, method, proxy, etc. readPreference: Function to read and process the response body (e.g., io.ReadAll,io.Read,).
Returns:
The response body as type T (string or []byte), and an error if any occurred.
type StringOrBytes ¶
Click to show internal directories.
Click to hide internal directories.