Documentation
¶
Overview ¶
Package probe dials an outbound and completes one HTTP request through it, timed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnusableInput = errors.New("unusable probe input")
ErrUnusableInput wraps a failure caused by Run's own arguments: an unusable probeURL, or a non-positive timeout. It means the arguments cannot produce a probe, not that the outbound or the target failed.
Functions ¶
func Run ¶
func Run(ctx context.Context, out A.Outbound, probeURL string, timeout time.Duration) (time.Duration, error)
Run dials out, completes an HTTP GET to probeURL over that one connection, discarding the body, and reports how long it took. A request that completes is a success whatever status it returned; when probeURL's handler confirms receipt, success also means the handler was reached. The connection is closed before Run returns.
The reported duration runs from the moment the request has been written to the conn to the end of the response body. The dial, any proxy or TLS handshake, and a handshake the outbound defers to the first write are excluded. For an outbound that sends the request before its server has connected to the target, that connect falls inside the timed window.
out's DialContext must return once ctx is cancelled or its deadline passes; Run returns no sooner than that dial does.
func ValidateURL ¶ added in v0.0.209
ValidateURL returns the ErrUnusableInput error Run would return for probeURL before dialing, or nil if Run would dial.
Types ¶
This section is empty.