httptransport

package
v3.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package httptransport contains HTTP transport extensions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteCountingTransport

type ByteCountingTransport struct {
	RoundTripper
	Counter *bytecounter.Counter
}

ByteCountingTransport is a RoundTripper that counts bytes.

func (ByteCountingTransport) RoundTrip

func (txp ByteCountingTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements RoundTripper.RoundTrip

type Config

type Config struct {
	Dialer     Dialer
	QUICDialer QUICDialer
	TLSDialer  TLSDialer
	TLSConfig  *tls.Config
}

Config contains the configuration required for constructing an HTTP transport

type Dialer

type Dialer interface {
	DialContext(ctx context.Context, network, address string) (net.Conn, error)
}

Dialer is the definition of dialer assumed by this package.

type HTTP3Transport

type HTTP3Transport struct {
	http3.RoundTripper
}

HTTP3Transport is a httptransport.RoundTripper using the http3 protocol.

func (*HTTP3Transport) CloseIdleConnections

func (t *HTTP3Transport) CloseIdleConnections()

CloseIdleConnections closes all the connections opened by this transport.

type Logger

type Logger interface {
	Debugf(format string, v ...interface{})
	Debug(message string)
}

Logger is the logger assumed by this package

type LoggingTransport

type LoggingTransport struct {
	RoundTripper
	Logger Logger
}

LoggingTransport is a logging transport

func (LoggingTransport) RoundTrip

func (txp LoggingTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements RoundTripper.RoundTrip

type QUICDialer

type QUICDialer interface {
	Dial(network, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlySession, error)
}

QUICDialer is the definition of dialer for QUIC assumed by this package.

type QUICWrapperDialer

type QUICWrapperDialer struct {
	Dialer quicdialer.ContextDialer
}

QUICWrapperDialer is a QUICDialer that wraps a ContextDialer This is necessary because the http3 RoundTripper does not support a DialContext method.

func (QUICWrapperDialer) Dial

func (d QUICWrapperDialer) Dial(network, host string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlySession, error)

Dial implements QUICDialer.Dial

type Resolver

type Resolver interface {
	LookupHost(ctx context.Context, hostname string) (addrs []string, err error)
	Network() string
	Address() string
}

Resolver is the interface we expect from a resolver

type RoundTripper

type RoundTripper interface {
	RoundTrip(req *http.Request) (*http.Response, error)
	CloseIdleConnections()
}

RoundTripper is the definition of http.RoundTripper used by this package.

func NewHTTP3Transport

func NewHTTP3Transport(config Config) RoundTripper

NewHTTP3Transport creates a new HTTP3Transport instance.

func NewSystemTransport

func NewSystemTransport(config Config) RoundTripper

NewSystemTransport creates a new "system" HTTP transport. That is a transport using the Go standard library with custom dialer and TLS dialer.

type SaverBodyHTTPTransport

type SaverBodyHTTPTransport struct {
	RoundTripper
	Saver        *trace.Saver
	SnapshotSize int
}

SaverBodyHTTPTransport is a RoundTripper that saves body events occurring during the round trip

func (SaverBodyHTTPTransport) RoundTrip

func (txp SaverBodyHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements RoundTripper.RoundTrip

type SaverMetadataHTTPTransport

type SaverMetadataHTTPTransport struct {
	RoundTripper
	Saver     *trace.Saver
	Transport string
}

SaverMetadataHTTPTransport is a RoundTripper that saves events related to HTTP request and response metadata

func (SaverMetadataHTTPTransport) RoundTrip

func (txp SaverMetadataHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements RoundTripper.RoundTrip

type SaverPerformanceHTTPTransport

type SaverPerformanceHTTPTransport struct {
	RoundTripper
	Saver *trace.Saver
}

SaverPerformanceHTTPTransport is a RoundTripper that saves performance events occurring during the round trip

func (SaverPerformanceHTTPTransport) RoundTrip

func (txp SaverPerformanceHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements RoundTripper.RoundTrip

type SaverTransactionHTTPTransport

type SaverTransactionHTTPTransport struct {
	RoundTripper
	Saver *trace.Saver
}

SaverTransactionHTTPTransport is a RoundTripper that saves events related to the HTTP transaction

func (SaverTransactionHTTPTransport) RoundTrip

func (txp SaverTransactionHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements RoundTripper.RoundTrip

type TLSDialer

type TLSDialer interface {
	DialTLSContext(ctx context.Context, network, address string) (net.Conn, error)
}

TLSDialer is the definition of a TLS dialer assumed by this package.

type UserAgentTransport

type UserAgentTransport struct {
	RoundTripper
}

UserAgentTransport is a transport that ensures that we always set an OONI specific default User-Agent header.

func (UserAgentTransport) RoundTrip

func (txp UserAgentTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements RoundTripper.RoundTrip

Jump to

Keyboard shortcuts

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