cloudflare

package
v0.0.0-...-7c54f9f Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExpirationTime is the time after which a file download link expires.
	ExpirationTime = 24 * time.Hour * 30 // 30 days
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint         *string `long:"endpoint" description:"Cloudflare R2 endpoint."`
	AccessKey        string  `long:"access_key" description:"Cloudflare R2 API token."`
	SecretAccessKey  string  `long:"secret_access_key" description:"Cloudflare R2 API token."`
	PublicBucketName string  `long:"public_bucket_name" description:"Cloudflare R2 public bucket name."`
	APIToken         string  `long:"api_token" description:"Cloudflare API token for Streams"`
	AccountID        string  `long:"account_id" description:"Cloudflare account ID"`
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns all default values for the Config struct.

type R2Service

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

func NewR2Service

func NewR2Service(cfg *Config) (*R2Service, error)

type Service

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

Service is the main storage service interface.

func NewService

func NewService(cfg *Config) (*Service, error)

NewService creates a new storage service.

func (*Service) DeletePublicFile

func (s *Service) DeletePublicFile(ctx context.Context, key string) error

func (*Service) GenerateStreamURL

func (s *Service) GenerateStreamURL(ctx context.Context,
	key string) (string, string, error)

GenerateVideoViewURL generates a presigned URL for a video in the storage provider.

func (*Service) GenerateVideoUploadURL

func (s *Service) GenerateVideoUploadURL(ctx context.Context) (string,
	string, error)

func (*Service) GetStreamVideoInfo

func (s *Service) GetStreamVideoInfo(ctx context.Context,
	externalID string) (*cloudflare.StreamVideo, error)

func (*Service) PublicFileURL

func (s *Service) PublicFileURL(key string) string

PublicFileURL returns the URL of a file in the storage provider.

func (*Service) UploadPublicFile

func (s *Service) UploadPublicFile(ctx context.Context, fileID string,
	prefix string, reader io.ReadSeeker) (string, error)

type StreamsService

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

func NewStreamsService

func NewStreamsService(cfg *Config) (*StreamsService, error)

Jump to

Keyboard shortcuts

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