Documentation ¶
Index ¶
- Constants
- type Config
- type R2Service
- type Service
- func (s *Service) DeletePublicFile(ctx context.Context, key string) error
- func (s *Service) GenerateStreamURL(ctx context.Context, key string) (string, string, error)
- func (s *Service) GenerateVideoUploadURL(ctx context.Context) (string, string, error)
- func (s *Service) GetStreamVideoInfo(ctx context.Context, externalID string) (*cloudflare.StreamVideo, error)
- func (s *Service) PublicFileURL(key string) string
- func (s *Service) UploadPublicFile(ctx context.Context, fileID string, prefix string, reader io.ReadSeeker) (string, error)
- type StreamsService
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 ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the main storage service interface.
func NewService ¶
NewService creates a new storage service.
func (*Service) DeletePublicFile ¶
func (*Service) GenerateStreamURL ¶
GenerateVideoViewURL generates a presigned URL for a video in the storage provider.
func (*Service) GenerateVideoUploadURL ¶
func (*Service) GetStreamVideoInfo ¶
func (*Service) PublicFileURL ¶
PublicFileURL returns the URL of a file in the storage provider.
type StreamsService ¶
type StreamsService struct {
// contains filtered or unexported fields
}
func NewStreamsService ¶
func NewStreamsService(cfg *Config) (*StreamsService, error)
Click to show internal directories.
Click to hide internal directories.