httptracex

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package httptracex contains httptrace extensions. We use these extensions in OONI for two purposes:

1. to emit more precise logging during normal operations, using the code in here combined with the httplog package;

2. to perform network measurements, as the code in here allows to collect more information of what happens when fetching an URL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	// DNSStart is called when we start name resolution.
	DNSStart(host string)

	// DNSDone is called after name resolution.
	DNSDone(addrs []net.IPAddr, err error)

	// ConnectStart is called when we start connecting.
	ConnectStart(network, addr string)

	// ConnectDone is called after connect.
	ConnectDone(network, addr string, err error)

	// TLSHandshakeStart is called when we start the TLS handshake.
	TLSHandshakeStart()

	// TLSHandshakeDone is called after the TLS handshake.
	TLSHandshakeDone(state tls.ConnectionState, err error)

	// ConnectionReady is called when a connection is ready to be used.
	ConnectionReady(conn net.Conn)

	// WroteHeaderField is called when a header field is written.
	WroteHeaderField(key string, values []string)

	// WroteHeaders is called when all headers are written.
	WroteHeaders(request *http.Request)

	// WroteRequest is called after the request has been written.
	WroteRequest(err error)

	// GotFirstResponseByte is called when we start reading the response.
	GotFirstResponseByte()

	// GotHeaders is called when we've got the response headers.
	GotHeaders(response *http.Response)
}

Handler handles HTTP events.

type Measurer

type Measurer struct {
	// RoundTripper is the child http.RoundTripper.
	http.RoundTripper

	// Handler is the event handler
	Handler Handler
}

Measurer is an extended http.RoundTripper.

func (*Measurer) RoundTrip

func (m *Measurer) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip performs an HTTP round trip.

Jump to

Keyboard shortcuts

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