retryhttpclient

package
v3.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ContextVarKey = "__ctx"

Variables

View Source
var (
	RtryRedirect   *retryablehttp.Client
	RtryNoRedirect *retryablehttp.Client
)
View Source
var (
	HTTP_PREFIX  = "http://"
	HTTPS_PREFIX = "https://"
)

Functions

func AddNetInflight added in v3.2.8

func AddNetInflight(delta int64)

func AddRawInflight added in v3.2.8

func AddRawInflight(delta int64)

func AddTaskGateWait added in v3.2.8

func AddTaskGateWait(d time.Duration)

func ApplyHeaderLines added in v3.2.8

func ApplyHeaderLines(req *retryablehttp.Request, headerLines []string, overwrite bool)

func CheckProtocol

func CheckProtocol(host string) (string, error)

func CloseIdleConnections added in v3.5.3

func CloseIdleConnections()

func ContextFromVariableMap added in v3.2.8

func ContextFromVariableMap(variableMap map[string]any) context.Context

func DefaultAcceptEnabled added in v3.3.5

func DefaultAcceptEnabled() bool

func Get

func Get(target string) ([]byte, int, error)

func GetDefaultTimeout

func GetDefaultTimeout() time.Duration

func GetMaxDefaultBody

func GetMaxDefaultBody() int64

func GetReqLimitPerTarget added in v3.2.8

func GetReqLimitPerTarget() int

func GetTimeout

func GetTimeout(target string, timeout time.Duration) ([]byte, int, error)

func Init

func Init(opt *Options) (err error)

func IsCheckProtocolSuppressed added in v3.3.5

func IsCheckProtocolSuppressed(err error) bool

func IsCriticalHeader added in v3.2.8

func IsCriticalHeader(key string) bool

func ParseRequest

func ParseRequest(oReq *http.Request) (*proto.Request, error)

func Request

func Request(target string, header []string, rule poc.Rule, variableMap map[string]any) error

func ReverseGet

func ReverseGet(target string) ([]byte, error)

Reverse URL Get request

func SetReqLimitPerTarget added in v3.2.8

func SetReqLimitPerTarget(rate int)

func StartAutoReqLimit added in v3.2.8

func StartAutoReqLimit(stop <-chan struct{}, minRate int, maxRate int)

func Url2UrlType

func Url2UrlType(u *url.URL) *proto.UrlType

func WaitHostPort added in v3.2.8

func WaitHostPort(ctx context.Context, host string, port string) error

func WriteHTTPRequestToVars added in v3.2.8

func WriteHTTPRequestToVars(variableMap map[string]any, req *retryablehttp.Request, body string, target string, u *url.URL)

func WriteHTTPResponseToVars added in v3.2.8

func WriteHTTPResponseToVars(variableMap map[string]any, resp *http.Response, body []byte, latency int64)

Types

type LiveMetrics added in v3.2.8

type LiveMetrics struct {
	HTTPInflight      int64
	RawInflight       int64
	NetInflight       int64
	ReqLimitWaitNs    int64
	ReqLimitWaitCount int64
	TaskGateWaitNs    int64
	TaskGateWaitCount int64
}

func GetLiveMetrics added in v3.2.8

func GetLiveMetrics() LiveMetrics

type Options

type Options struct {
	Proxy             string
	Timeout           int
	Retries           int
	MaxRespBodySize   int
	ReqLimitPerTarget int
	DefaultAccept     bool
}

Jump to

Keyboard shortcuts

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