net

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EndpointAmazonAWS          = ".amazonaws.com"
	EndpointDigitalOceanSpaces = ".digitaloceanspaces.com"
)

S3 Provider Endpoints.

Variables

View Source
var (
	EndpointDigitalOceanSpacesRegion = func(region string) string { return region + EndpointDigitalOceanSpaces }
	EndpointAmazonAWSRegion          = func(region string) string { return "s3." + region + EndpointDigitalOceanSpaces }
)

S3 Provider Endpoints with region.

Functions

This section is empty.

Types

type DownloadFunc

type DownloadFunc func(job types.Job) error

DownloadFunc creates a download.

type ProgressReader

type ProgressReader struct {
	Progress int
	// contains filtered or unexported fields
}

ProgressReader for uploading progress.

func (*ProgressReader) Read

func (r *ProgressReader) Read(p []byte) (int, error)

func (*ProgressReader) ReadAt

func (r *ProgressReader) ReadAt(p []byte, off int64) (int, error)

func (*ProgressReader) Seek

func (r *ProgressReader) Seek(offset int64, whence int) (int64, error)

type ProgressWriter

type ProgressWriter struct {
	// contains filtered or unexported fields
}

ProgressWriter tracks the download progress.

func (*ProgressWriter) WriteAt

func (pw *ProgressWriter) WriteAt(p []byte, off int64) (int, error)

type S3

type S3 struct {
	Progress progress
	Writer   *ProgressWriter
	Reader   *ProgressReader

	Endpoint       string
	AccessKey      string
	SecretKey      string
	Region         string
	InboundBucket  string
	OutboundBucket string
}

S3 creates a new S3 instance.

func GetDownloader

func GetDownloader() *S3

GetDownloader sets the download function.

func GetUploader

func GetUploader() *S3

GetUploader gets the upload function.

func NewS3

func NewS3(accessKey, secretKey, provider, region, inboundBucket, outboundBucket string) *S3

NewS3 creates a new S3 instance.

func (*S3) S3Download

func (s *S3) S3Download(job types.Job) error

S3Download downloads source files from S3.

func (*S3) S3ListFiles

func (s *S3) S3ListFiles(prefix string) (*s3.ListObjectsV2Output, error)

S3ListFiles lists s3 objects for a given prefix.

func (*S3) S3Upload

func (s *S3) S3Upload(job types.Job) error

S3Upload uploads a file to S3.

type UploadFunc

type UploadFunc func(job types.Job) error

UploadFunc creates a upload.

Jump to

Keyboard shortcuts

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