download

package
v1.4.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 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

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

func WithEndpointFunc(endpointFunc func() string) Option

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

func WithErrorOnEmptyResponse

func WithErrorOnEmptyResponse(e error) Option

WithErrorOnEmptyResponse provides specific error to return when response is empty.

func WithErrorOnNotFound

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

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