package
0.0.16
Repository: https://github.com/oarkflow/protocol.git
Documentation: pkg.go.dev

# Functions

DefaultBackoff provides a default callback for Client.Backoff which will perform exponential backoff based on the attempt number and limited by the provided minimum and maximum durations.
DefaultClient DefaultPooledClient returns a new http.Client with similar default values to http.Client, but with a shared Transport.
DefaultHostSprayingTransport returns a new http.Transport with similar default values to http.DefaultTransport, but with idle connections and keep alive disabled.
DefaultRetryPolicy provides a default callback for Client.CheckRetry, which will retry on connection errors and server errors.
DefaultReusePooledTransport returns a new http.Transport with similar default values to http.DefaultTransport.
DefaultSprayingClient DefaultClient returns a new http.Client with similar default values to http.Client, but with a non-shared Transport, idle connections disabled, and keepalives disabled.
Discard is an helper function that discards the response body and closes the underlying connection.
ExponentialJitterBackoff provides a callback for Client.Backoff which will perform en exponential backoff based on the attempt number and with jitter to prevent a thundering herd.
FromRequest wraps an http.Request in a retryablehttp.Request.
FromRequestWithTrace wraps an http.Request in a retryablehttp.Request with trace enabled.
FullJitterBackoff implements capped exponential backoff with jitter.
HostSprayRetryPolicy provides a callback for Client.CheckRetry, which will retry on connection errors and server errors.
LinearJitterBackoff provides a callback for Client.Backoff which will perform linear backoff based on the attempt number and with jitter to prevent a thundering herd.
NewClient creates a new Client with default settings.
NewRequest creates a new wrapped request.
NewRequestWithContext creates a new wrapped request with context.
NewWithHTTPClient creates a new Client with default settings and provided http.Client.

# Variables

DefaultOptionsSingle contains the default options for host bruteforce scenarios where lots of requests need to be sent to a single host.
DefaultOptionsSpraying contains the default options for host spraying scenarios where lots of requests need to be sent to different hosts.

# Structs

No description provided by the author
No description provided by the author
Client is used to make HTTP requests.
No description provided by the author
Metrics contains the metrics about each request.
No description provided by the author
Options contains configuration options for the client.
Request wraps the metadata needed to create HTTP requests.

# Interfaces

No description provided by the author
LenReader is an interface implemented by many in-memory io.Reader's.

# Type aliases

Backoff specifies a policy for how long to wait between retries.
CheckRetry specifies a policy for handling retries.
ErrorHandler is called if retries are expired, containing the last status from the http library.
ReaderFunc is the type of function that can be given natively to NewRequest.
RequestLogHook allows a function to run before each retry.
ResponseLogHook is like RequestLogHook, but allows running a function on each HTTP response.