httpx

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package httpx provides an HTTP client for PSFuzz with proxy, TLS, throttling, and safe-mode (no loopback) support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(cfg *config.Config) (*Client, error)

New builds an HTTP client from cfg. Returns an error if cfg is nil (callers can handle instead of panic).

func (*Client) Close

func (c *Client) Close()

Close releases resources (e.g. rate-limit ticker). Call when the client is no longer used.

func (*Client) Do

func (c *Client) Do(ctx context.Context, spec RequestSpec) (*DoResult, error)

func (*Client) Replay

func (c *Client) Replay(ctx context.Context, spec RequestSpec, proxyURL string)

func (*Client) SetScale

func (c *Client) SetScale(scale float64)

type DoResult

type DoResult struct {
	Resp     *http.Response
	FinalURL string
}

DoResult holds the HTTP response and the final URL after following redirects (when FollowRedirects is true). FinalURL is the URL that produced Resp; if redirects were followed, it differs from the initial request URL.

type Doer

type Doer interface {
	Do(ctx context.Context, spec RequestSpec) (*DoResult, error)
}

Doer performs HTTP requests. *Client implements Doer.

type RequestSpec

type RequestSpec struct {
	URL     string
	Method  string
	Body    string
	Headers map[string]string
	Delay   time.Duration
}

Jump to

Keyboard shortcuts

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