Documentation
¶
Index ¶
Constants ¶
View Source
const Version = "0.1.1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ServerAddr string
Aria2Addr string
StorageType string
DefaultBucket string
// AllowBucketOverride specifies whether the requester can override the bucket to upload to
AllowBucketOverride bool
// AllowNoName specifies whether the requester may omit the name from the request.
// Arias would use the name of the downloaded file in that case
AllowNoName bool
}
func LoadConfig ¶
type DownloadRequest ¶
type DownloadRequest struct {
Url string `schema:"url"`
Bucket string `schema:"bucket"`
Name string `schema:"name"`
CallbackUrl string `schema:"callback"`
}
func (*DownloadRequest) Check ¶
func (req *DownloadRequest) Check() error
func (*DownloadRequest) UseConfig ¶
func (req *DownloadRequest) UseConfig(c *Config) error
type DownloadResponse ¶
type DownloadResponse struct {
Id string `json:"id"`
}
type DownloadTask ¶
func NewDownloadTask ¶
func NewDownloadTask(server *Server, req DownloadRequest) DownloadTask
type Server ¶
type Server struct {
Router chi.Router
HttpClient *http.Client
Config Config
AriaClient aria2.Client
Storage Storage
// contains filtered or unexported fields
}
func (*Server) GoSendCallback ¶
func (*Server) ListenAndServe ¶
func (*Server) PerformTask ¶
type Storage ¶
type Storage interface {
Upload(ctx context.Context, f io.ReadSeeker, options UploadOptions) (UploadOutput, error)
}
func NewGoogleCloudStorage ¶
func NewGoogleCloudStorage(opts ...option.ClientOption) (s Storage, err error)
func NewStorageFromType ¶
type TaskStatus ¶
type TaskStatus struct {
Id string `json:"id"`
Running bool `json:"running"`
State string `json:"state"`
Result interface{} `json:"result,omitempty"`
Err interface{} `json:"error,omitempty"`
}
func NewTaskStatus ¶
func NewTaskStatus(id string) *TaskStatus
func (*TaskStatus) Done ¶
func (status *TaskStatus) Done(res interface{})
func (*TaskStatus) EnterState ¶
func (status *TaskStatus) EnterState(state string)
func (*TaskStatus) Error ¶
func (status *TaskStatus) Error(err error)
func (*TaskStatus) Start ¶
func (status *TaskStatus) Start()
type UploadOptions ¶
type UploadOutput ¶
Click to show internal directories.
Click to hide internal directories.