download

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, endpoint string, opts ...Option) (b []byte, err error)

Download downloads a config.

func NewTFTPTransport added in v0.4.0

func NewTFTPTransport() http.RoundTripper

NewTFTPTransport returns an http.RoundTripper capable of handling the TFTP protocol.

Types

type Option

type Option func(*downloadOptions)

Option configures the download options.

func WithEndpointFunc added in v1.2.0

func WithEndpointFunc(endpointFunc func() string) Option

WithEndpointFunc provides a function that sets the endpoint of the download options.

func WithErrorOnEmptyResponse added in v0.8.0

func WithErrorOnEmptyResponse(e error) Option

WithErrorOnEmptyResponse provides specific error to return when response is empty.

func WithErrorOnNotFound added in v0.8.0

func WithErrorOnNotFound(e error) Option

WithErrorOnNotFound provides specific error to return when response has HTTP 404 error.

func WithFormat

func WithFormat(format string) Option

WithFormat specifies the source format. This ultimately will be a yaml but may be represented in different formats. For example, the config may be base64 encoded.

func WithHeaders

func WithHeaders(headers map[string]string) Option

WithHeaders specifies any http headers that are needed for downloading the config.

func WithLowSrcPort added in v1.0.0

func WithLowSrcPort() Option

WithLowSrcPort sets low source port to download the config.

Jump to

Keyboard shortcuts

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