Documentation
¶
Index ¶
- type Result
- func (r *Result) ConnectDuration() time.Duration
- func (r *Result) DNSDuration() time.Duration
- func (r *Result) StringVerbose() string
- func (r *Result) TLSDuration() time.Duration
- func (r *Result) TTFB() time.Duration
- func (r *Result) Total() time.Duration
- func (r *Result) WriteTimings(w io.Writer)
- func (r *Result) WriteTo(w io.Writer) (int64, error)
- func (r *Result) WriteVerbose(w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
// Raw phase timestamps (zero if phase not reached).
Start time.Time
DNSStart, DNSDone time.Time
ConnStart, ConnDone time.Time
TLSStart, TLSDone time.Time
FirstByte time.Time
End time.Time
// Outcome
Method string
URL string
Status string
Proto string
Err error
RespHeader http.Header
TLSState *tls.ConnectionState
// Whether the underlying connection was reused.
ReusedConn bool
}
Result holds timing phases & response metadata for one HTTP request.
func Diagnose ¶
func Diagnose(ctx context.Context, rawURL string, method string, client *http.Client) (*Result, error)
Diagnose executes a single HTTP request (default HEAD) and returns a populated Result. method="" defaults to HEAD; pass GET if you want body download to influence Total. ctx controls total timeout / cancellation *outside* the per-request http.Client timeout you might add.
func (*Result) ConnectDuration ¶
func (*Result) DNSDuration ¶
Durations (computed lazily so callers can format however they want)
func (*Result) StringVerbose ¶
func (*Result) TLSDuration ¶
func (*Result) WriteTimings ¶
WriteTimings writes only the curl -w style timing summary.
Click to show internal directories.
Click to hide internal directories.