shared

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRoundTripper http.RoundTripper = &http.Transport{
	Proxy: http.ProxyFromEnvironment,
	DialContext: (&net.Dialer{
		Timeout:   30 * time.Second,
		KeepAlive: 30 * time.Second,
	}).DialContext,
	TLSHandshakeTimeout: 10 * time.Second,
}

DefaultRoundTripper is our default RoundTripper.

Functions

This section is empty.

Types

type BasicAuthTransport

type BasicAuthTransport struct {
	Transport http.RoundTripper
	Username  string
	Password  string
}

BasicAuthTransport is the struct to add basic auth to a RoundTripper.

func (BasicAuthTransport) RoundTrip

func (bat BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTrip for our RoundTripper with basic auth support.

type TokenAuthTransporter

type TokenAuthTransporter struct {
	Transport http.RoundTripper
	Token     string
}

TokenAuthTransporter is the struct to add token auth to a RoundTripper.

func (TokenAuthTransporter) RoundTrip

func (tat TokenAuthTransporter) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTrip for our RoundTripper with token auth support.

Jump to

Keyboard shortcuts

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