request

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticatedRequest

func AuthenticatedRequest(address string, opts ...RequestOption) ([]byte, string, int, int, 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) (string, string, int, int, error)

AuthenticatedRequestDownload fetches a url using a secret and auth description. Returns temp file path, sha1, size, response code. Caller is responsible for deleting the file.

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 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