service

package
v0.0.0-...-47a8ef8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	Username       string
	Password       []byte
	SessionID      string
	ByteDownloaded uint
}

type AuthenticationService

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

func NewAuthenticationService

func NewAuthenticationService(storage IAuthStorage) *AuthenticationService

func (*AuthenticationService) AddByteDownloaded

func (a *AuthenticationService) AddByteDownloaded(sessionID string, size uint) error

func (*AuthenticationService) Authenticate

func (a *AuthenticationService) Authenticate(username, password string) (string, error)

func (*AuthenticationService) CheckAuthentication

func (a *AuthenticationService) CheckAuthentication(sessionID string) error

func (*AuthenticationService) FindBySessionID

func (a *AuthenticationService) FindBySessionID(sessionID string) (*Authentication, error)

func (*AuthenticationService) GetByteDownloaded

func (a *AuthenticationService) GetByteDownloaded(sessionID string) (uint, error)

func (*AuthenticationService) ListAllUsage

func (a *AuthenticationService) ListAllUsage(limit, offset uint) ([]*Usage, error)

func (*AuthenticationService) NewAuthentication

func (a *AuthenticationService) NewAuthentication(username, password string) error

type DownloadJob

type DownloadJob struct {
	Link string
	Mode int
	URL  string
}

type DownloaderService

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

func NewDownloaderService

func NewDownloaderService(storage IFileStorage) *DownloaderService

func (*DownloaderService) Download

func (d *DownloaderService) Download(link string) ([]byte, error)

func (*DownloaderService) GetVideoQuality

func (d *DownloaderService) GetVideoQuality(link string) ([]string, error)

func (*DownloaderService) Request

func (d *DownloaderService) Request(link string, mode int) (string, error)

type FileBasedStorageService

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

func NewFileStorageService

func NewFileStorageService(baseDir string) *FileBasedStorageService

func (*FileBasedStorageService) Contain

func (f *FileBasedStorageService) Contain(name string) (bool, error)

func (*FileBasedStorageService) Create

func (f *FileBasedStorageService) Create(name string) error

func (*FileBasedStorageService) Read

func (f *FileBasedStorageService) Read(name string) ([]byte, error)

func (*FileBasedStorageService) Rename

func (f *FileBasedStorageService) Rename(from string, to string) error

func (*FileBasedStorageService) Write

func (f *FileBasedStorageService) Write(name string, body []byte) error

type FileBlobStorageService

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

func NewFileBlobStorageService

func NewFileBlobStorageService(baseDir, accountName, accountKey string) *FileBlobStorageService

func (*FileBlobStorageService) Contain

func (f *FileBlobStorageService) Contain(name string) (bool, error)

func (*FileBlobStorageService) Create

func (f *FileBlobStorageService) Create(name string) error

func (*FileBlobStorageService) Read

func (f *FileBlobStorageService) Read(name string) ([]byte, error)

func (*FileBlobStorageService) Rename

func (f *FileBlobStorageService) Rename(from string, to string) error

func (*FileBlobStorageService) Write

func (f *FileBlobStorageService) Write(name string, body []byte) error

type IAuthStorage

type IAuthStorage interface {
	Insert(auth *Authentication) error
	Update(auth *Authentication) error
	FindBySessionID(sessionID string) (*Authentication, error)
	FindByUsername(username string) (*Authentication, error)
	List(limit uint, offset uint) ([]*Authentication, error)
}

type IFileStorage

type IFileStorage interface {
	Create(name string) error
	Write(name string, body []byte) error
	Read(name string) ([]byte, error)
	Rename(from string, to string) error
	Contain(name string) (bool, error)
}

type InMemoryAuthentication

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

func NewInMemoryAuthentication

func NewInMemoryAuthentication() *InMemoryAuthentication

func (*InMemoryAuthentication) FindBySessionID

func (i *InMemoryAuthentication) FindBySessionID(sessionID string) (*Authentication, error)

func (*InMemoryAuthentication) FindByUsername

func (i *InMemoryAuthentication) FindByUsername(username string) (*Authentication, error)

func (*InMemoryAuthentication) Insert

func (i *InMemoryAuthentication) Insert(auth *Authentication) error

func (*InMemoryAuthentication) List

func (i *InMemoryAuthentication) List(limit uint, offset uint) ([]*Authentication, error)

func (*InMemoryAuthentication) Update

func (i *InMemoryAuthentication) Update(auth *Authentication) error

type RedisAuthentication

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

func NewRedisAuthentication

func NewRedisAuthentication(option *redis.Options) *RedisAuthentication

func (*RedisAuthentication) FindBySessionID

func (i *RedisAuthentication) FindBySessionID(sessionID string) (*Authentication, error)

func (*RedisAuthentication) FindByUsername

func (i *RedisAuthentication) FindByUsername(username string) (*Authentication, error)

func (*RedisAuthentication) Insert

func (i *RedisAuthentication) Insert(auth *Authentication) error

func (*RedisAuthentication) List

func (i *RedisAuthentication) List(limit uint, offset uint) ([]*Authentication, error)

func (*RedisAuthentication) Update

func (i *RedisAuthentication) Update(auth *Authentication) error

type Usage

type Usage struct {
	Username           string
	MegaByteDownloaded uint
}

Jump to

Keyboard shortcuts

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