net

package
v0.0.0-...-7090a5b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDialTimeout = 5 * time.Second
)

Variables

View Source
var NewHTTPClient = func(tr *http.Transport, dumper RequestDumper) HTTPClientInterface {
	c := client{
		&http.Client{
			Transport: tr,
		},
		dumper,
	}
	c.CheckRedirect = c.checkRedirect

	return &c
}

Functions

func NewTLSConfig

func NewTLSConfig(trustedCerts []tls.Certificate, disableSSL bool) (TLSConfig *tls.Config)

func WrapNetworkErrors

func WrapNetworkErrors(host string, err error) error

Types

type Gateway

type Gateway struct {
	DialTimeout time.Duration
	// contains filtered or unexported fields
}

func NewGateway

func NewGateway(config config.Reader) *Gateway

func (Gateway) Get

func (gateway Gateway) Get(url string) (*http.Response, error)

func (Gateway) NewRequest

func (gateway Gateway) NewRequest(method, path, secret, key string, body io.ReadSeeker) (*http.Request, error)

func (*Gateway) SetTrustedCerts

func (gateway *Gateway) SetTrustedCerts(certificates []tls.Certificate)

type HTTPClientInterface

type HTTPClientInterface interface {
	RequestDumperInterface

	Do(*http.Request) (*http.Response, error)
	ExecuteCheckRedirect(req *http.Request, via []*http.Request) error
}

type RequestDumper

type RequestDumper struct {
}

func NewRequestDumper

func NewRequestDumper() RequestDumper

func (RequestDumper) DumpRequest

func (p RequestDumper) DumpRequest(req *http.Request)

func (RequestDumper) DumpResponse

func (p RequestDumper) DumpResponse(res *http.Response)

type RequestDumperInterface

type RequestDumperInterface interface {
	DumpRequest(*http.Request)
	DumpResponse(*http.Response)
}

Jump to

Keyboard shortcuts

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