request

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: GPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFTP

func DownloadFTP(ctx context.Context, ustr string, secret tl.Secret, auth tl.FeedAuthorization) (io.ReadCloser, error)

func DownloadHTTP

func DownloadHTTP(ctx context.Context, ustr string, secret tl.Secret, auth tl.FeedAuthorization) (io.ReadCloser, int, error)

func DownloadS3

func DownloadS3(ctx context.Context, ustr string, secret tl.Secret, auth tl.FeedAuthorization) (io.ReadCloser, error)

func UploadS3

func UploadS3(ctx context.Context, ustr string, secret tl.Secret, uploadFile io.Reader) error

func WithAllowFTP

func WithAllowFTP(req *Request)

func WithAllowLocal

func WithAllowLocal(req *Request)

func WithAllowS3

func WithAllowS3(req *Request)

func WithAuth

func WithAuth(secret tl.Secret, auth tl.FeedAuthorization) func(req *Request)

Types

type FetchResponse added in v0.10.2

type FetchResponse struct {
	Filename     string
	Data         []byte
	ResponseSize int
	ResponseCode int
	ResponseSHA1 string
	FetchError   error
}

func AuthenticatedRequest

func AuthenticatedRequest(address string, opts ...RequestOption) (FetchResponse, error)

AuthenticatedRequest fetches a url using a secret and auth description. Returns []byte, sha1, size, response code.

func AuthenticatedRequestDownload

func AuthenticatedRequestDownload(address string, opts ...RequestOption) (FetchResponse, error)

type Request

type Request struct {
	URL        string
	AllowFTP   bool
	AllowS3    bool
	AllowLocal bool
	Secret     tl.Secret
	Auth       tl.FeedAuthorization
}

func NewRequest

func NewRequest(address string, opts ...RequestOption) *Request

func (*Request) Request

func (req *Request) Request(ctx context.Context) (io.ReadCloser, int, error)

type RequestOption

type RequestOption func(*Request)

Jump to

Keyboard shortcuts

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