pkg

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_2xx = 2
	HTTP_4xx = 4
)

Variables

This section is empty.

Functions

func ExpBackoff

func ExpBackoff(interval, max time.Duration) time.Duration

Types

type Err

type Err error

type ErrInvalid

type ErrInvalid struct {
	Err
}

type ErrNetwork

type ErrNetwork struct {
	Err
}

type ErrNotFound

type ErrNotFound struct {
	Err
}

type ErrServer

type ErrServer struct {
	Err
}

type ErrTimeout

type ErrTimeout struct {
	Err
}

type Getter

type Getter interface {
	Get(string) ([]byte, error)
	GetRetry(string) ([]byte, error)
}

type HttpClient

type HttpClient struct {
	// Maximum exp backoff duration. Defaults to 5 seconds
	MaxBackoff time.Duration

	// Maximum number of connection retries. Defaults to 15
	MaxRetries int

	// HTTP client timeout, this is suggested to be low since exponential
	// backoff will kick off too. Defaults to 2 seconds
	Timeout time.Duration

	// Whether or not to skip TLS verification. Defaults to false
	SkipTLS bool
	// contains filtered or unexported fields
}

func NewHttpClient

func NewHttpClient() *HttpClient

func (*HttpClient) Get

func (h *HttpClient) Get(dataURL string) ([]byte, error)

func (*HttpClient) GetRetry

func (h *HttpClient) GetRetry(rawurl string) ([]byte, error)

GetRetry fetches a given URL with support for exponential backoff and maximum retries

Jump to

Keyboard shortcuts

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