Documentation
¶
Overview ¶
Package fshttp contains the common http parts of the config, Transport and Client
Index ¶
- Variables
- func NewClient(ctx context.Context) *http.Client
- func NewClientCustom(ctx context.Context, customize func(*http.Transport)) *http.Client
- func NewClientWithUnixSocket(ctx context.Context, path string) *http.Client
- func NewTransport(ctx context.Context) http.RoundTripper
- func NewTransportCustom(ctx context.Context, customize func(*http.Transport)) http.RoundTripper
- func ResetTransport()
- type Dialer
- type Metrics
- type Transport
Constants ¶
This section is empty.
Variables ¶
var DefaultMetrics = (*Metrics)(nil)
DefaultMetrics specifies metrics used for new Transports.
var ( // UnixSocketConfig describes the option to configure the path to a unix domain socket to connect to UnixSocketConfig = fs.Option{ Name: "unix_socket", Help: "Path to a unix domain socket to dial to, instead of opening a TCP connection directly", Advanced: true, Default: "", } )
Functions ¶
func NewClientCustom ¶ added in v1.70.1
NewClientCustom returns an http.Client with the correct timeouts. It allows customizing the transport, using NewTransportCustom.
func NewClientWithUnixSocket ¶ added in v1.70.1
NewClientWithUnixSocket returns an http.Client with the correct timeout. It internally uses NewClientCustom with a custom dialer connecting to the specified unix domain socket.
func NewTransport ¶
func NewTransport(ctx context.Context) http.RoundTripper
NewTransport returns an http.RoundTripper with the correct timeouts
func NewTransportCustom ¶ added in v1.6.1
NewTransportCustom returns an http.RoundTripper with the correct timeouts. The customize function is called if set to give the caller an opportunity to customize any defaults in the Transport.
func ResetTransport ¶ added in v1.6.1
func ResetTransport()
ResetTransport resets the existing transport, allowing it to take new settings. Should only be used for testing.
Types ¶
type Dialer ¶ added in v1.55.0
Dialer structure contains default dialer and timeout, tclass support
func NewDialer ¶
NewDialer creates a Dialer structure with Timeout, Keepalive, LocalAddr and DSCP set from rclone flags.
type Metrics ¶ added in v1.57.1
type Metrics struct {
StatusCode *prometheus.CounterVec
}
Metrics provide Transport HTTP level metrics.
func NewMetrics ¶ added in v1.57.1
NewMetrics creates a new metrics instance, the instance shall be assigned to DefaultMetrics before any processing takes place.
func (*Metrics) Collectors ¶ added in v1.57.1
func (m *Metrics) Collectors() []prometheus.Collector
Collectors returns all prometheus metrics as collectors for registration.
type Transport ¶
Transport is our http Transport which wraps an http.Transport * Sets the User Agent * Does logging * Updates metrics
func (*Transport) SetRequestFilter ¶
SetRequestFilter sets a filter to be used on each request